home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_11_05
/
1105108a
< prev
next >
Wrap
Text File
|
1993-03-09
|
1KB
|
50 lines
/* list.c: List directory */
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
int Order = 1,
Full = 0;
static void dir(char *);
main(int argc, char **argv)
{
char *p;
/* Process options */
while (--argc && **++argv == '-')
{
for (p = *argv+1; *p; ++p)
switch(toupper(*p))
{
case 'L':
Full = !Full;
break;
case 'R':
Order = -1;
break;
default:
fprintf(stderr,
"list: Invalid flag: %c\n",*p);
return EXIT_FAILURE;
}
}
/* List all files by default */
if (argc == 0)
dir("*.*");
else
while (argc--)
dir(*argv++);
}
static void dir(char *template)
{
/* Replace this stub with working code */
fprintf(stderr,"Dir: %s (Order = %d, Full = %d)\n",
template,Order,Full);
}