1 /* $Id: args.c,v 1.9 2003-06-16 06:57:34 btb Exp $ */
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-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
17 * Functions for accessing arguments.
20 * Revision 2.0 1995/02/27 11:31:22 john
21 * New version 2.0, which has no anonymous unions, builds with
22 * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
24 * Revision 1.9 1994/11/29 01:07:57 john
25 * Took out some unused vars.
27 * Revision 1.8 1994/11/29 01:04:30 john
28 * Took out descent.ini stuff.
30 * Revision 1.7 1994/09/20 19:29:15 matt
31 * Made args require exact (not substring), though still case insensitive.
33 * Revision 1.6 1994/07/25 12:33:11 john
34 * Network "pinging" in.
36 * Revision 1.5 1994/06/17 18:07:50 matt
39 * Revision 1.4 1994/05/11 19:45:33 john
40 * *** empty log message ***
42 * Revision 1.3 1994/05/11 18:42:11 john
43 * Added Descent.ini config file.
45 * Revision 1.2 1994/05/09 17:03:30 john
46 * Split command line parameters into arg.c and arg.h.
47 * Also added /dma, /port, /irq to digi.c
49 * Revision 1.1 1994/05/09 16:49:11 john
60 static char rcsid[] = "$Id: args.c,v 1.9 2003-06-16 06:57:34 btb Exp $";
74 int FindArg( char * s ) {
77 for (i=0; i<Num_args; i++ )
78 if (! strcasecmp( Args[i], s))
87 for (i=0; i< Num_args; i++ )
91 void InitArgs( int argc,char **argv )
99 for (i=0; i<argc; i++ )
100 Args[Num_args++] = d_strdup( argv[i] );
103 for (i=0; i< Num_args; i++ ) {
104 if ( Args[i][0] == '-' )
105 strlwr( Args[i] ); // Convert all args to lowercase
107 if((i=FindArg("-ini")))
108 f = cfopen(Args[i+1], "rt");
110 f = cfopen("d2x.ini", "rt");
115 line=fsplitword(f,'\n');
116 word=splitword(line,' ');
118 Args[Num_args++] = d_strdup(word);
121 Args[Num_args++] = d_strdup(line);
123 d_free(line); d_free(word);