From 6617c9a7135ccf619bca80ef83eeaaff5d7e7964 Mon Sep 17 00:00:00 2001 From: Bobbi Webber-Manners Date: Sun, 14 Jun 2020 23:03:02 -0400 Subject: [PATCH] Fixup for builds where CHECK and FREELIST are not defined --- sortdir.c | 24 ++++++++++++++++++++++-- sortdir.po | Bin 143360 -> 143360 bytes 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/sortdir.c b/sortdir.c index 08630b9..f2bd7f9 100644 --- a/sortdir.c +++ b/sortdir.c @@ -45,6 +45,7 @@ * v0.81 Do not trim volume directory to <4 blocks. * v0.82 Minor fix to TRIMDIR conditional compilation. * v0.83 Print additional info on each file. + * v0.84 Minor fixup for builds without CHECK and FREELIST defined. */ //#pragma debug 9 @@ -244,10 +245,13 @@ static const char err_rdblk1[] = "Can't read blk %u"; static const char err_rdblk2[] = "Can't read blk %u ($%2x)"; static const char err_wtblk1[] = "Can't write blk %u"; static const char err_wtblk2[] = "Can't write blk %u ($%2x)"; +#ifdef CHECK static const char err_stype2[] = "Bad storage type $%2x for %s"; +#endif static const char err_odir1[] = "Can't open dir %s"; static const char err_rddir1[] = "Can't read dir %s"; static const char err_rdpar[] = "Can't read parent dir"; +#ifdef CHECK static const char err_sdname[] = "Bad subdir name"; static const char err_entsz2[] = "Bad entry size %u, should be %u"; static const char err_entblk2[] = "Bad entries/blk %u, should be %u"; @@ -256,6 +260,7 @@ static const char err_hdrblk2[] = "Bad hdr blk %u, should be %u"; static const char err_access[] = "Bad access"; static const char err_forksz3[] = "%s fork size %u is wrong, should be %u"; static const char err_used2[] = "Blks used %u is wrong, should be %u"; +#endif static const char err_many[] = "Too many files to sort"; static const char err_count2[] = "Filecount %u wrong, should be %u"; static const char err_nosort[] = "Not sorting due to errors"; @@ -1215,7 +1220,10 @@ int readdir(uint device, uint blocknum) { struct block *curblk; struct datetime dt; ulong eof; - uint filecount, idx, subdirs, blks, keyblk, hdrblk, count, entries, auxtype; + uint filecount, idx, subdirs, blks, keyblk, hdrblk, entries, auxtype; +#ifdef CHECK + uint count; +#endif uchar blkentries, i; uint errsbefore = errcount; uint blkcnt = 1; @@ -1960,6 +1968,7 @@ uchar writedir(uchar device) { err(NONFATAL, err_wtblk1, b->blocknum); return 1; } +#ifdef FREELIST } else { /* Standard volume directory is blocks 2-5 (4 blocks) * We will not trim volume directory to less than 4 blocks @@ -1969,11 +1978,16 @@ uchar writedir(uchar device) { trimdirblock(b->blocknum); } } +#else + } +#endif b = b->next; } return 0; } +#ifdef FREELIST + /* * Write the freelist back to disk. */ @@ -1995,6 +2009,8 @@ uchar writefreelist(uchar device) { return 0; } +#endif + /* * Walk through the linked list freeing memory */ @@ -2031,7 +2047,7 @@ void interactive(void) { revers(1); hlinechar(' '); - fputs("S O R T D I R v0.83 alpha Use ^ to return to previous question", stdout); + fputs("S O R T D I R v0.84 alpha Use ^ to return to previous question", stdout); hlinechar(' '); revers(0); @@ -2406,6 +2422,8 @@ int main() { _heapadd((void*)0x0800, 0x1800); //printf("\nHeap: %u %u\n", _heapmemavail(), _heapmaxavail()); +#ifdef FREELIST + #ifdef AUXMEM freelist = (uchar*)auxalloc(FLSZ); #else @@ -2421,6 +2439,8 @@ int main() { if (!usedlist) err(FATALALLOC, err_nomem); +#endif + #ifdef AUXMEM lockaux(); // Protect free list and used list #endif diff --git a/sortdir.po b/sortdir.po index 4356960653b9b613191f409822ac3e00230d14d0..ba3106b0d0666d0c0ea09e1b8dd524ecf92d81d8 100644 GIT binary patch delta 231 zcmZp8z|ru4W5X^MZYJ@%|Bo3M&S@}-Z$8S>J%y2HbKuMn7Dm3w%jRk@N^U+scQzBF z=;Z7LlI;8n^D7kI>P#+NAk4@=dHw=Paj=Myo{yU2N{2<070MeHF|1@*z%%*$0x_V9 zXA3OlcoY;`fzk`a74j++EE^W^gXpa_7npt4J1*dzY`ai{QFwCie5uI|3%P;Dn${A}@A4@Q&b NEpN7OdBf=A3;+`QQ~&?~ delta 231 zcmZp8z|ru4W5X^MZauNO|Bo3M&S~h0Z9dAP#+NAj~K{dHw=Paj=Myo{yU2N{2<070MeHF|1@*ATas-0x_V9 zXA3Ol1QZlnfzk`a74j++EE^UGgXpa_7npt4J1!8MY`YL>$K>AmQj;4Nas!Rat60Ra zhykdIqjdozOv~g&3!NGHHa}aqfRT}Ra{FQ>MnRAkp3lw;G@)vECtp}B%E-I<+2XSv QjK