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-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
14 * $Source: /cvs/cvsroot/d2x/misc/args.c,v $
17 * $Date: 2002-01-18 07:02:23 $
19 * Functions for accessing arguments.
21 * $Log: not supported by cvs2svn $
22 * Revision 1.5 2001/11/09 06:57:27 bradleyb
23 * use d2x.ini for option file
25 * Revision 1.4 2001/11/05 07:39:26 bradleyb
26 * Change args_init back to InitArgs
28 * Revision 1.3 2001/01/31 15:18:04 bradleyb
29 * Makefile and conf.h fixes
31 * Revision 1.2 2001/01/24 04:29:48 bradleyb
32 * changed args_find to FindArg
34 * Revision 1.1.1.1 2001/01/19 03:30:14 bradleyb
37 * Revision 1.3 1999/08/05 22:53:41 sekmu
39 * D3D patch(es) from ADB
41 * Revision 1.2 1999/06/14 23:44:11 donut
42 * Orulz' svgalib/ggi/noerror patches.
44 * Revision 1.1.1.1 1999/06/14 22:05:15 donut
45 * Import of d1x 1.37 source.
47 * Revision 2.0 1995/02/27 11:31:22 john
48 * New version 2.0, which has no anonymous unions, builds with
49 * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
51 * Revision 1.9 1994/11/29 01:07:57 john
52 * Took out some unused vars.
54 * Revision 1.8 1994/11/29 01:04:30 john
55 * Took out descent.ini stuff.
57 * Revision 1.7 1994/09/20 19:29:15 matt
58 * Made args require exact (not substring), though still case insensitive.
60 * Revision 1.6 1994/07/25 12:33:11 john
61 * Network "pinging" in.
63 * Revision 1.5 1994/06/17 18:07:50 matt
66 * Revision 1.4 1994/05/11 19:45:33 john
67 * *** empty log message ***
69 * Revision 1.3 1994/05/11 18:42:11 john
70 * Added Descent.ini config file.
72 * Revision 1.2 1994/05/09 17:03:30 john
73 * Split command line parameters into arg.c and arg.h.
74 * Also added /dma, /port, /irq to digi.c
76 * Revision 1.1 1994/05/09 16:49:11 john
87 static char rcsid[] = "$Id: args.c,v 1.6 2002-01-18 07:02:23 bradleyb Exp $";
100 int FindArg( char * s ) {
103 for (i=0; i<Num_args; i++ )
104 if (! strcasecmp( Args[i], s))
113 for (i=0; i< Num_args; i++ )
117 void InitArgs( int argc,char **argv )
125 for (i=0; i<argc; i++ )
126 Args[Num_args++] = d_strdup( argv[i] );
129 for (i=0; i< Num_args; i++ ) {
130 if ( Args[i][0] == '-' )
131 strlwr( Args[i] ); // Convert all args to lowercase
133 if((i=FindArg("-ini")))
134 f=fopen(Args[i+1],"rt");
136 f=fopen("d2x.ini","rt");
138 f=fopen("d1x.ini","rt");
143 line=fsplitword(f,'\n');
144 word=splitword(line,' ');
146 Args[Num_args++] = d_strdup(word);
149 Args[Num_args++] = d_strdup(line);
151 d_free(line); d_free(word);