mirror of
https://github.com/bobbimanners/ProDOS-Utils.git
synced 2024-09-27 17:57:25 +00:00
Made code work properly when CHECK is disabled (#undef CHECK).
This commit is contained in:
parent
06b30cf0c2
commit
4d8aa68495
20
sortdir.c
20
sortdir.c
@ -26,6 +26,7 @@
|
|||||||
* v0.60 Modified fileent to be a union. Build it for each subsort. Saves RAM.
|
* v0.60 Modified fileent to be a union. Build it for each subsort. Saves RAM.
|
||||||
* v0.61 Squeezed fileent to be a few bytes smaller. Fixed folder sort.
|
* v0.61 Squeezed fileent to be a few bytes smaller. Fixed folder sort.
|
||||||
* v0.62 Modified buildsorttable() to update existing filelist[].
|
* v0.62 Modified buildsorttable() to update existing filelist[].
|
||||||
|
* v0.63 Made code work properly with #undef CHECK.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#pragma debug 9
|
//#pragma debug 9
|
||||||
@ -203,12 +204,12 @@ static char sortopts[NLEVELS+1] = ""; /* -s:abc list of sort options */
|
|||||||
static char caseopts[2] = ""; /* -c:x case conversion option */
|
static char caseopts[2] = ""; /* -c:x case conversion option */
|
||||||
static char fixopts[2] = ""; /* -f:x fix mode option */
|
static char fixopts[2] = ""; /* -f:x fix mode option */
|
||||||
static char dateopts[2] = ""; /* -d:x date conversion option */
|
static char dateopts[2] = ""; /* -d:x date conversion option */
|
||||||
static struct fileent *filelist; /* Used for qsort() */
|
|
||||||
|
|
||||||
// Allocated dynamically in main()
|
// Allocated dynamically in main()
|
||||||
static char *buf; /* General purpose scratch buffer */
|
static char *buf; /* General purpose scratch buffer */
|
||||||
static char *buf2; /* General purpose scratch buffer */
|
static char *buf2; /* General purpose scratch buffer */
|
||||||
static char *dirblkbuf; /* Used for reading directory blocks */
|
static char *dirblkbuf; /* Used for reading directory blocks */
|
||||||
|
static struct fileent *filelist; /* Used for qsort() */
|
||||||
|
|
||||||
/* Prototypes */
|
/* Prototypes */
|
||||||
#ifdef AUXMEM
|
#ifdef AUXMEM
|
||||||
@ -239,12 +240,14 @@ int isused(uint blk);
|
|||||||
void markused(uint blk);
|
void markused(uint blk);
|
||||||
void checkblock(uint blk, char *msg);
|
void checkblock(uint blk, char *msg);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CHECK
|
||||||
int seedlingblocks(uchar device, uint keyblk, uint *blkcnt);
|
int seedlingblocks(uchar device, uint keyblk, uint *blkcnt);
|
||||||
int saplingblocks(uchar device, uint keyblk, uint *blkcnt);
|
int saplingblocks(uchar device, uint keyblk, uint *blkcnt);
|
||||||
int treeblocks(uchar device, uint keyblk, uint *blkcnt);
|
int treeblocks(uchar device, uint keyblk, uint *blkcnt);
|
||||||
int forkblocks(uchar device, uint keyblk, uint *blkcnt);
|
int forkblocks(uchar device, uint keyblk, uint *blkcnt);
|
||||||
int subdirblocks(uchar device, uint keyblk, struct pd_dirent *ent,
|
int subdirblocks(uchar device, uint keyblk, struct pd_dirent *ent,
|
||||||
uint blocknum, uint blkentries, uint *blkcnt);
|
uint blocknum, uint blkentries, uint *blkcnt);
|
||||||
|
#endif
|
||||||
void enqueuesubdir(uint blocknum, uint subdiridx);
|
void enqueuesubdir(uint blocknum, uint subdiridx);
|
||||||
int readdir(uint device, uint blocknum);
|
int readdir(uint device, uint blocknum);
|
||||||
#ifdef SORT
|
#ifdef SORT
|
||||||
@ -433,7 +436,7 @@ int writediskblock(uchar device, uint blocknum, char *buf) {
|
|||||||
int rc;
|
int rc;
|
||||||
if ((strcmp(currdir, "LIB") == 0) ||
|
if ((strcmp(currdir, "LIB") == 0) ||
|
||||||
(strcmp(currdir, "LIBRARIES") == 0)) {
|
(strcmp(currdir, "LIBRARIES") == 0)) {
|
||||||
printf("Not writing library directory %s\n", currdir);
|
printf("Not writing lib dir %s\n", currdir);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
flushall();
|
flushall();
|
||||||
@ -813,6 +816,8 @@ void checkblock(uint blk, char *msg) {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CHECK
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Count the blocks in a seedling file
|
* Count the blocks in a seedling file
|
||||||
*/
|
*/
|
||||||
@ -1033,6 +1038,8 @@ int subdirblocks(uchar device, uint keyblk, struct pd_dirent *ent,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Record the keyblock of a subdirectory to be processed subsequently
|
* Record the keyblock of a subdirectory to be processed subsequently
|
||||||
* blocknum is the block number of the subdirectory keyblock
|
* blocknum is the block number of the subdirectory keyblock
|
||||||
@ -1182,7 +1189,6 @@ int readdir(uint device, uint blocknum) {
|
|||||||
fixcase(ent->name, namebuf,
|
fixcase(ent->name, namebuf,
|
||||||
ent->vers, ent->minvers, ent->typ_len & 0x0f);
|
ent->vers, ent->minvers, ent->typ_len & 0x0f);
|
||||||
|
|
||||||
#ifdef CHECK
|
|
||||||
switch (ent->typ_len & 0xf0) {
|
switch (ent->typ_len & 0xf0) {
|
||||||
case 0x10:
|
case 0x10:
|
||||||
fputs("Seed ", stdout);
|
fputs("Seed ", stdout);
|
||||||
@ -1207,7 +1213,7 @@ int readdir(uint device, uint blocknum) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fputs(namebuf, stdout);
|
fputs(namebuf, stdout);
|
||||||
#endif
|
|
||||||
blks = ent->blksused[0] + 256U * ent->blksused[1];
|
blks = ent->blksused[0] + 256U * ent->blksused[1];
|
||||||
eof = ent->eof[0] + 256L * ent->eof[1] + 65536L * ent->eof[2];
|
eof = ent->eof[0] + 256L * ent->eof[1] + 65536L * ent->eof[2];
|
||||||
|
|
||||||
@ -1283,7 +1289,11 @@ int readdir(uint device, uint blocknum) {
|
|||||||
if (errcount == errsbeforeent) {
|
if (errcount == errsbeforeent) {
|
||||||
for (i = 0; i < 53 - strlen(namebuf); ++i)
|
for (i = 0; i < 53 - strlen(namebuf); ++i)
|
||||||
putchar(' ');
|
putchar(' ');
|
||||||
|
#ifdef CHECK
|
||||||
printf("%5u blocks [ OK ]", blks);
|
printf("%5u blocks [ OK ]", blks);
|
||||||
|
#else
|
||||||
|
printf("%5u blocks\n", blks);
|
||||||
|
#endif
|
||||||
} else
|
} else
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
++entries;
|
++entries;
|
||||||
@ -1835,7 +1845,7 @@ void interactive(void) {
|
|||||||
|
|
||||||
doverbose = 1;
|
doverbose = 1;
|
||||||
|
|
||||||
puts("S O R T D I R v0.62 alpha Use ^ to return to previous question");
|
puts("S O R T D I R v0.63 alpha Use ^ to return to previous question");
|
||||||
|
|
||||||
q1:
|
q1:
|
||||||
fputs("\nEnter path (e.g.: /H1) of starting directory> ", stdout);
|
fputs("\nEnter path (e.g.: /H1) of starting directory> ", stdout);
|
||||||
|
BIN
sortdir.po
BIN
sortdir.po
Binary file not shown.
Loading…
Reference in New Issue
Block a user