]> icculus.org git repositories - btb/d2x.git/blob - misc/parsarg.h
Implement strdup for MPW
[btb/d2x.git] / misc / parsarg.h
1 /* $Id: parsarg.h,v 1.2 2003-02-18 20:35:35 btb Exp $ */
2 /*
3 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
4 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
5 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
6 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
7 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
8 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
9 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
10 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
11 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
12 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
13 */
14
15
16 /*
17  *
18  * Routine to parse the command line. Will also read and parse args
19  * from a file.
20  *
21  * parse_args() is called with argc & argv from main(), the function
22  * to be called with each argument, and flags.  argc & argv are usually
23  * adjusted to not pass the first parameter (the program file name).
24  * Thus the general method of calling is:
25  *
26  *  parse_args(argc-1,argv+1,hander_func,flags);
27  *
28  * handler_func() is then called with each parameter.
29  *
30  * If the PA_EXPAND flag is passed, all arguments which do not start
31  * with '-' are assumed to be filenames and are expanded for wildcards,
32  * with the handler function called for each match.  If a spec matches
33  * nothing, the spec itself is passed to the handler func.
34  *
35  * Args that start with '@' are assumed to be argument files.  These
36  * files are opened, and arguments are read from them just as if they
37  * were specified on the command line.  Arg files can be nested.
38  *
39  */
40
41 //Flags
42
43 #define PA_EXPAND       1       //wildcard expand args that don't start with '-'
44
45
46 //Function
47
48 void parse_args(int argc,char **argv,void (*handler_func)(char *arg),int flags);
49