projects
/
debian
/
cpmtools
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Upstream version 2.17
[debian/cpmtools]
/
device_posix.c
diff --git
a/device_posix.c
b/device_posix.c
index 82071a4e080071e037104ab353536ee31a930f55..0393eed716f39ae3c0edc9634c10d465166a7570 100644
(file)
--- a/
device_posix.c
+++ b/
device_posix.c
@@
-1,20
+1,16
@@
/* #includes */ /*{{{C}}}*//*{{{*/
/* #includes */ /*{{{C}}}*//*{{{*/
-#undef _POSIX_SOURCE
-#define _POSIX_SOURCE 1
-#undef _POSIX_C_SOURCE
-#define _POSIX_C_SOURCE 2
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
+#include "config.h"
#include <assert.h>
#include <errno.h>
#include <assert.h>
#include <errno.h>
-#include "config.h"
#include <stdlib.h>
#include <string.h>
#include "device.h"
#include <stdlib.h>
#include <string.h>
#include "device.h"
+
+#ifdef USE_DMALLOC
+#include <dmalloc.h>
+#endif
/*}}}*/
/* Device_open -- Open an image file */ /*{{{*/
/*}}}*/
/* Device_open -- Open an image file */ /*{{{*/
@@
-26,11
+22,12
@@
const char *Device_open(struct Device *this, const char *filename, int mode, con
}
/*}}}*/
/* Device_setGeometry -- Set disk geometry */ /*{{{*/
}
/*}}}*/
/* Device_setGeometry -- Set disk geometry */ /*{{{*/
-void Device_setGeometry(struct Device *this, int secLength, int sectrk, int tracks)
+void Device_setGeometry(struct Device *this, int secLength, int sectrk, int tracks
, off_t offset
)
{
this->secLength=secLength;
this->sectrk=sectrk;
this->tracks=tracks;
{
this->secLength=secLength;
this->sectrk=sectrk;
this->tracks=tracks;
+ this->offset=offset;
}
/*}}}*/
/* Device_close -- Close an image file */ /*{{{*/
}
/*}}}*/
/* Device_close -- Close an image file */ /*{{{*/
@@
-49,7
+46,7
@@
const char *Device_readSector(const struct Device *this, int track, int sector,
assert(sector<this->sectrk);
assert(track>=0);
assert(track<this->tracks);
assert(sector<this->sectrk);
assert(track>=0);
assert(track<this->tracks);
- if (lseek(this->fd,(off_t)(
sector+track*this->sectrk)*this->secLength
,SEEK_SET)==-1)
+ if (lseek(this->fd,(off_t)(
((sector+track*this->sectrk)*this->secLength)+this->offset)
,SEEK_SET)==-1)
{
return strerror(errno);
}
{
return strerror(errno);
}
@@
-71,7
+68,7
@@
const char *Device_writeSector(const struct Device *this, int track, int sector,
assert(sector<this->sectrk);
assert(track>=0);
assert(track<this->tracks);
assert(sector<this->sectrk);
assert(track>=0);
assert(track<this->tracks);
- if (lseek(this->fd,(off_t)(
sector+track*this->sectrk)*this->secLength,
SEEK_SET)==-1)
+ if (lseek(this->fd,(off_t)(
((sector+track*this->sectrk)*this->secLength)+this->offset),
SEEK_SET)==-1)
{
return strerror(errno);
}
{
return strerror(errno);
}