aboutsummaryrefslogtreecommitdiff
path: root/ksiders/atrdir.c
diff options
context:
space:
mode:
Diffstat (limited to 'ksiders/atrdir.c')
-rw-r--r--ksiders/atrdir.c89
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);
+ }
+
+
+
+