#include <string.h>
#include "cpmfs.h"
+
+#ifdef USE_DMALLOC
+#include <dmalloc.h>
+#endif
/*}}}*/
extern char **environ;
{
const char *msg;
char bmap[18*80];
- int secmap,pos,system,directory;
+ int secmap,pos,sys,directory;
clear();
msg="Data map";
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)
{
}
if (optind!=(argc-1)) usage=1;
- else image=argv[optind];
+ else image=argv[optind++];
if (usage)
{
{
/* 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);
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: ");
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: ");
/*}}}*/
case 'P': /* previous track */ /*{{{*/
{
- if (pos>drive.sectrk*drive.secLength)
+ if (pos>=drive.sectrk*drive.secLength)
{
pos-=drive.sectrk*drive.secLength;
reload=1;