diff options
author | B. Watson <urchlay@slackware.uk> | 2024-05-10 17:24:40 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-05-10 17:24:40 -0400 |
commit | f9dcbdd176785dfc9d49f3113ec6110199e9a246 (patch) | |
tree | f132ba50240e442f3c669bdbbfe014843db47701 /ksiders/atrdir.c | |
parent | 516fd094e69c64cecab68ce7a7751c0fa5d868ef (diff) | |
download | bw-atari8-tools-f9dcbdd176785dfc9d49f3113ec6110199e9a246.tar.gz |
import ken siders atr utilities.
Diffstat (limited to 'ksiders/atrdir.c')
-rw-r--r-- | ksiders/atrdir.c | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/ksiders/atrdir.c b/ksiders/atrdir.c new file mode 100644 index 0000000..62920c0 --- /dev/null +++ b/ksiders/atrdir.c @@ -0,0 +1,89 @@ +/* Copyright 1997 Ken Siders */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include "atr.h" +#include "atdos.h" + +void help(void) + { + printf("usage: atrdir atrname.atr [filespec]\n"); + printf("\n"); + printf("\n\n"); + } + + +int main( int argc, char **argv) + { + AtrFilePtr atr; + int minCnt; + char option; + static char mask[80]; + + + printf("AtrDir Version 0.9u (c)1997 Ken Siders\n"); + printf("Ported and modified by B. Watson, 2007\n"); + printf("This program may be freely distributed\n\n"); + + if (argc < 2) + { + help(); + exit(2); + } + + if (argv[1][0] == '-') + { + option = argv[1][1]; + minCnt = 3; + } + else + { + option = 0; + minCnt = 2; + } + + if ( argc != minCnt && argc != minCnt + 1) + { + help(); + exit(4); + } + + if (option && option != 'W' && option != 'w' ) + { + help(); + exit(5); + } + + atr = OpenAtr(argv[minCnt-1]); + if (atr == 0) + { + printf("Error reading ATR file: %s\n", argv[1]); + exit(2); + } + else + { + CloseAtr(atr); + } + + if (argc == minCnt) + strcpy(mask, "*.*"); + else + strcpy(mask, argv[minCnt]); + printf("Directory of %s:%s:\n", argv[minCnt-1], mask); + AtariDirectory( argv[minCnt-1], mask); + + + + + + + + /* printf("\n%d file(s)\n", count); */ + + exit(0); + } + + + + |