make lintian happier
[debian/cpmtools] / device_posix.c
index 0393eed716f39ae3c0edc9634c10d465166a7570..fd425cafed1fdb649d087c523d46b83101a0ed57 100644 (file)
@@ -3,31 +3,33 @@
 
 #include <assert.h>
 #include <errno.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
 #include "device.h"
-
-#ifdef USE_DMALLOC
-#include <dmalloc.h>
-#endif
 /*}}}*/
 
 /* Device_open           -- Open an image file                      */ /*{{{*/
 const char *Device_open(struct Device *this, const char *filename, int mode, const char *deviceOpts)
 {
+  if (deviceOpts != NULL)
+  {
+    return "POSIX driver accepts no options (build compiled without libdsk)";
+  }
   this->fd=open(filename,mode);
   this->opened=(this->fd==-1?0:1);
   return ((this->fd==-1)?strerror(errno):(const char*)0);
 }
 /*}}}*/
 /* Device_setGeometry    -- Set disk geometry                       */ /*{{{*/
-void Device_setGeometry(struct Device *this, int secLength, int sectrk, int tracks, off_t offset)
+const char *Device_setGeometry(struct Device *this, int secLength, int sectrk, int tracks, off_t offset, const char *libdskGeometry)
 {
   this->secLength=secLength;
   this->sectrk=sectrk;
   this->tracks=tracks;
   this->offset=offset;
+  return NULL;
 }
 /*}}}*/
 /* Device_close          -- Close an image file                     */ /*{{{*/
@@ -42,10 +44,12 @@ const char *Device_readSector(const struct Device *this, int track, int sector,
 {
   int res;
 
+  assert(this);
   assert(sector>=0);
   assert(sector<this->sectrk);
   assert(track>=0);
   assert(track<this->tracks);
+  assert(buf);
   if (lseek(this->fd,(off_t)(((sector+track*this->sectrk)*this->secLength)+this->offset),SEEK_SET)==-1) 
   {
     return strerror(errno);
@@ -56,7 +60,11 @@ const char *Device_readSector(const struct Device *this, int track, int sector,
     {
       return strerror(errno);
     }
-    else memset(buf+res,0,this->secLength-res); /* hit end of disk image */
+    else
+{
+printf("len %d\n",this->secLength-res);
+ memset(buf+res,0,this->secLength-res); /* hit end of disk image */
+}
   }
   return (const char*)0;
 }