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