X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=fsed.cpm.c;h=b717bfffc6e8be055151371c8ba68515cbe05e2c;hb=90e0f2eba429f24e3377d9625963fbc3325f0df1;hp=dfd94670ba79fe62a5776b91cb051b7b5106eec9;hpb=32087c67d53a8f8058b359388f23e2dbc9436d54;p=debian%2Fcpmtools diff --git a/fsed.cpm.c b/fsed.cpm.c index dfd9467..b717bff 100644 --- a/fsed.cpm.c +++ b/fsed.cpm.c @@ -10,6 +10,10 @@ #include #include "cpmfs.h" + +#ifdef USE_DMALLOC +#include +#endif /*}}}*/ extern char **environ; @@ -83,7 +87,7 @@ static void map(struct cpmSuperBlock *sb) /*{{{*/ { const char *msg; char bmap[18*80]; - int secmap,pos,system,directory; + int secmap,pos,sys,directory; clear(); msg="Data map"; @@ -91,11 +95,11 @@ static void map(struct cpmSuperBlock *sb) /*{{{*/ secmap=(sb->tracks*sb->sectrk+80*18-1)/(80*18); memset(bmap,' ',sizeof(bmap)); - system=sb->boottrk*sb->sectrk; - memset(bmap,'S',system/secmap); + sys=sb->boottrk*sb->sectrk; + memset(bmap,'S',sys/secmap); directory=(sb->maxdir*32+sb->secLength-1)/sb->secLength; - memset(bmap+system/secmap,'D',directory/secmap); - memset(bmap+(system+directory)/secmap,'.',sb->sectrk*sb->tracks/secmap); + memset(bmap+sys/secmap,'D',directory/secmap); + memset(bmap+(sys+directory)/secmap,'.',sb->sectrk*sb->tracks/secmap); for (pos=0; pos<(sb->maxdir*32+sb->secLength-1)/sb->secLength; ++pos) { @@ -180,7 +184,7 @@ int main(int argc, char *argv[]) /*{{{*/ } if (optind!=(argc-1)) usage=1; - else image=argv[optind]; + else image=argv[optind++]; if (usage) { @@ -220,25 +224,23 @@ int main(int argc, char *argv[]) /*{{{*/ { /* display position and load data */ /*{{{*/ clear(); - move(2,0); printw("Byte %8d (0x%08x) ",pos,pos); + move(2,0); printw("Byte %8lu (0x%08lx) ",pos,pos); if (pos<(drive.boottrk*drive.sectrk*drive.secLength)) { - printw("Physical sector %3d ",((pos/drive.secLength)%drive.sectrk)+1); + printw("Physical sector %3lu ",((pos/drive.secLength)%drive.sectrk)+1); } else { - printw("Sector %3d ",((pos/drive.secLength)%drive.sectrk)+1); + printw("Sector %3lu ",((pos/drive.secLength)%drive.sectrk)+1); printw("(physical %3d) ",drive.skewtab[(pos/drive.secLength)%drive.sectrk]+1); } - printw("Offset %5d ",pos%drive.secLength); - printw("Track %5d",pos/(drive.secLength*drive.sectrk)); + printw("Offset %5lu ",pos%drive.secLength); + printw("Track %5lu",pos/(drive.secLength*drive.sectrk)); move(LINES-3,0); printw("N)ext track P)revious track"); - move(LINES-2,0); printw("n)ext record n)revious record f)orward byte b)ackward byte"); + move(LINES-2,0); printw("n)ext record p)revious record f)orward byte b)ackward byte"); move(LINES-1,0); printw("i)nfo q)uit"); if (reload) { - const char *err; - if (pos<(drive.boottrk*drive.sectrk*drive.secLength)) { err=Device_readSector(&drive.dev,pos/(drive.secLength*drive.sectrk),(pos/drive.secLength)%drive.sectrk,buf); @@ -413,11 +415,11 @@ int main(int argc, char *argv[]) /*{{{*/ printw("Password: "); for (i=0; i<8; ++i) { - char c; + char printable; if (offset==16+(7-i)) attron(A_REVERSE); - c=(buf[entrystart+16+(7-i)]^buf[entrystart+13])&0x7f; - printw("%c",isprint(c) ? c : ' '); + printable=(buf[entrystart+16+(7-i)]^buf[entrystart+13])&0x7f; + printw("%c",isprint(printable) ? printable : ' '); attroff(A_REVERSE); } printw(" XOR value: "); @@ -592,11 +594,11 @@ int main(int argc, char *argv[]) /*{{{*/ printw("Password: "); for (i=0; i<8; ++i) { - char c; + char printable; if (offset==16+(7-i)) attron(A_REVERSE); - c=(buf[entrystart+16+(7-i)]^buf[entrystart+13])&0x7f; - printw("%c",isprint(c) ? c : ' '); + printable=(buf[entrystart+16+(7-i)]^buf[entrystart+13])&0x7f; + printw("%c",isprint(printable) ? printable : ' '); attroff(A_REVERSE); } printw(" XOR value: "); @@ -684,7 +686,7 @@ int main(int argc, char *argv[]) /*{{{*/ /*}}}*/ case 'P': /* previous track */ /*{{{*/ { - if (pos>drive.sectrk*drive.secLength) + if (pos>=drive.sectrk*drive.secLength) { pos-=drive.sectrk*drive.secLength; reload=1;