X-Git-Url: https://git.gag.com/?p=debian%2Fcpmtools;a=blobdiff_plain;f=fsed.cpm.c;h=f120b77c4a364749a3cdc119469acd710576a24b;hp=0c3f03f8ea5a3e418ff195e40d047be0c8a13cfb;hb=b1e873c5b2f6376bb39ff0fda1464cbbacbae5f7;hpb=edf600144998d1a1e09898548938cc11b95c10bc diff --git a/fsed.cpm.c b/fsed.cpm.c index 0c3f03f..f120b77 100644 --- a/fsed.cpm.c +++ b/fsed.cpm.c @@ -3,13 +3,23 @@ #include #include +#if NEED_NCURSES +#if HAVE_NCURSES_NCURSES_H +#include +#else +#include +#endif +#else #include +#endif #include #include #include #include +#include #include "cpmfs.h" +#include "getopt_.h" #ifdef USE_DMALLOC #include @@ -25,7 +35,7 @@ static struct tm *cpmtime(char lday, char hday, char hour, char min) /*{{{*/ static struct tm tm; unsigned long days=(lday&0xff)|((hday&0xff)<<8); int d; - int md[12]={31,0,31,30,31,30,31,31,30,31,30,31}; + unsigned int md[12]={31,0,31,30,31,30,31,31,30,31,30,31}; tm.tm_sec=0; tm.tm_min=((min>>4)&0xf)*10+(min&0xf); @@ -87,7 +97,8 @@ static void map(struct cpmSuperBlock *sb) /*{{{*/ { const char *msg; char bmap[18*80]; - int secmap,pos,sys,directory; + int secmap,sys,directory; + int pos; clear(); msg="Data map"; @@ -114,7 +125,7 @@ static void map(struct cpmSuperBlock *sb) /*{{{*/ { for (i=0; i<16; ++i) { - unsigned int sector; + int sector; sector=mapbuf[entry*32+16+i]&0xff; if (sb->size>=256) sector|=(((mapbuf[entry*32+16+ ++i]&0xff)<<8)); @@ -129,7 +140,7 @@ static void map(struct cpmSuperBlock *sb) /*{{{*/ } } - for (pos=0; possecLength)&~0x7f; - int i; + unsigned int i; for (i=0; i<128; ++i) { @@ -168,7 +179,7 @@ int main(int argc, char *argv[]) /*{{{*/ struct cpmInode root; const char *format; int c,usage=0; - unsigned long pos; + off_t pos; chtype ch; int reload; char *buf; @@ -196,10 +207,14 @@ int main(int argc, char *argv[]) /*{{{*/ /* open image */ /*{{{*/ if ((err=Device_open(&drive.dev,image,O_RDONLY,devopts))) { - fprintf(stderr,"%s: can not open %s (%s)\n",cmd,image,err); + fprintf(stderr,"%s: cannot open %s (%s)\n",cmd,image,err); + exit(1); + } + if (cpmReadSuper(&drive,&root,format)==-1) + { + fprintf(stderr,"%s: cannot read superblock (%s)\n",cmd,boo); exit(1); } - cpmReadSuper(&drive,&root,format); /*}}}*/ /* alloc sector buffers */ /*{{{*/ if ((buf=malloc(drive.secLength))==(char*)0 || (mapbuf=malloc(drive.secLength))==(char*)0) @@ -270,7 +285,7 @@ int main(int argc, char *argv[]) /*{{{*/ { case 'F': /* next 16 byte */ /*{{{*/ { - if (pos+16<(drive.sectrk*drive.tracks*(unsigned long)drive.secLength)) + if (pos+16<(drive.sectrk*drive.tracks*(off_t)drive.secLength)) { if (pos/drive.secLength!=(pos+16)/drive.secLength) reload=1; pos+=16; @@ -621,7 +636,7 @@ int main(int argc, char *argv[]) /*{{{*/ { case 'F': /* next entry */ /*{{{*/ { - if (pos+32<(drive.sectrk*drive.tracks*(unsigned long)drive.secLength)) + if (pos+32<(drive.sectrk*drive.tracks*(off_t)drive.secLength)) { if (pos/drive.secLength!=(pos+32)/drive.secLength) reload=1; pos+=32; @@ -657,7 +672,7 @@ int main(int argc, char *argv[]) /*{{{*/ { case 'n': /* next record */ /*{{{*/ { - if (pos+128<(drive.sectrk*drive.tracks*(unsigned long)drive.secLength)) + if (pos+128<(drive.sectrk*drive.tracks*(off_t)drive.secLength)) { if (pos/drive.secLength!=(pos+128)/drive.secLength) reload=1; pos+=128;