Mail Archives: djgpp/1992/03/27/15:19:43
Assuming you wanted to distribute a program, the only drawback of adding the globbing
routines to your program is the extra size overhead. In other words, if the shell expands
wildcards then calls to glob produce nothing--all files are single strings in argv[?]...
Of course you could also test for various shells and decide on a technique at run-time,
but this introduces more overhead and complicates matters greatly.
Why not create a library of routines that address the short comings of working in the dos
environment, add a standard include file to prototype/define the routines and link to it
at compile time?
#include <stdio.h>
#include <stdlib.h>
#include <mylib.h>
void
main(argc, argv)
int argc;
char **argv;
{
FILE *infile, *outfile;
char **globv;
char progname[8] = basename(argv[0]);
................... getopts stuff ....................
if (globv = glob_filenname(argv[1].................
[ rest of your program here ]
}
>gcc -O myprog.c -o myprog -lmy
-d.clifton [99clifto AT lab DOT cc DOT wmich DOT edu]
- Raw text -