mirror of
https://github.com/bobbimanners/ProDOS-Utils.git
synced 2024-06-08 19:29:28 +00:00
Made buf[] and buf2[] dynamically allocated
This commit is contained in:
parent
ca8c6d20fb
commit
e13161567b
23
sortdir.c
23
sortdir.c
|
@ -7,6 +7,10 @@
|
||||||
* TODO: Enable free list functionality on ProDOS-8
|
* TODO: Enable free list functionality on ProDOS-8
|
||||||
* TODO: Get both ProDOS-8 and GNO versions to build from this source
|
* TODO: Get both ProDOS-8 and GNO versions to build from this source
|
||||||
* TODO: Trimming unused directory blocks
|
* TODO: Trimming unused directory blocks
|
||||||
|
*
|
||||||
|
* Revision History
|
||||||
|
* v0.5 Initial alpha release on GitHub. Ported from GNO/ME version.
|
||||||
|
* v0.51 Made buf[] and buf2[] dynamic.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#pragma debug 9
|
//#pragma debug 9
|
||||||
|
@ -139,7 +143,9 @@ struct datetime {
|
||||||
uchar ispd25format;
|
uchar ispd25format;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Globals */
|
/*
|
||||||
|
* Globals
|
||||||
|
*/
|
||||||
#ifdef FREELIST
|
#ifdef FREELIST
|
||||||
static uint totblks; /* Total # blocks on volume */
|
static uint totblks; /* Total # blocks on volume */
|
||||||
static uchar *freelist; /* Free-list bitmap */
|
static uchar *freelist; /* Free-list bitmap */
|
||||||
|
@ -149,12 +155,9 @@ static uchar flloaded = 0; /* 1 if free-list has been loaded */
|
||||||
static char currdir[NMLEN+1]; /* Name of directory currently processed */
|
static char currdir[NMLEN+1]; /* Name of directory currently processed */
|
||||||
static struct block *blocks = NULL;
|
static struct block *blocks = NULL;
|
||||||
static struct dirblk *dirs = NULL;
|
static struct dirblk *dirs = NULL;
|
||||||
static struct fileent filelist[MAXFILES];
|
|
||||||
static uint numfiles;
|
static uint numfiles;
|
||||||
static uchar entsz; /* Bytes per file entry */
|
static uchar entsz; /* Bytes per file entry */
|
||||||
static uchar entperblk; /* Number of entries per block */
|
static uchar entperblk; /* Number of entries per block */
|
||||||
static char buf[BLKSZ]; /* General purpose scratch buffer */
|
|
||||||
static char buf2[BLKSZ]; /* General purpose scratch buffer */
|
|
||||||
static uint errcount = 0; /* Error counter */
|
static uint errcount = 0; /* Error counter */
|
||||||
static dhandle_t dio_hdl; /* cc64 direct I/O handle */
|
static dhandle_t dio_hdl; /* cc64 direct I/O handle */
|
||||||
static uchar dowholedisk = 0; /* -D whole-disk option */
|
static uchar dowholedisk = 0; /* -D whole-disk option */
|
||||||
|
@ -168,6 +171,11 @@ 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[MAXFILES]; /* Used for qsort() */
|
||||||
|
|
||||||
|
// Allocated dynamically in main()
|
||||||
|
static char *buf; /* General purpose scratch buffer */
|
||||||
|
static char *buf2; /* General purpose scratch buffer */
|
||||||
|
|
||||||
/* Prototypes */
|
/* Prototypes */
|
||||||
void hline(void);
|
void hline(void);
|
||||||
|
@ -1647,7 +1655,7 @@ void interactive(void) {
|
||||||
|
|
||||||
doverbose = 1;
|
doverbose = 1;
|
||||||
|
|
||||||
puts("S O R T D I R v0.5 alpha Use ^ to return to previous question");
|
puts("S O R T D I R v0.51 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);
|
||||||
|
@ -1987,6 +1995,11 @@ int main() {
|
||||||
_heapadd((void*)0x0800, 0x1800);
|
_heapadd((void*)0x0800, 0x1800);
|
||||||
//printf("\nHeap: %u %u\n", _heapmemavail(), _heapmaxavail());
|
//printf("\nHeap: %u %u\n", _heapmemavail(), _heapmaxavail());
|
||||||
|
|
||||||
|
// Allocate these dynamically so the .SYSTEM file is smaller!
|
||||||
|
//filelist = (struct fileent*)malloc(sizeof(struct fileent) * MAXFILES);
|
||||||
|
buf = (char*)malloc(sizeof(char) * BLKSZ);
|
||||||
|
buf2 = (char*)malloc(sizeof(char) * BLKSZ);
|
||||||
|
|
||||||
parseargs();
|
parseargs();
|
||||||
|
|
||||||
if (argc == 1)
|
if (argc == 1)
|
||||||
|
|
BIN
sortdir.po
BIN
sortdir.po
Binary file not shown.
Loading…
Reference in New Issue
Block a user