Mercurial > ~darius > hgwebdir.cgi > mikmod
comparison include/getopt.h @ 10:55420dceb8e0
Initial entry of mikmod into the CVS tree.
author | darius |
---|---|
date | Fri, 23 Jan 1998 16:05:11 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
9:990c9dadb348 | 10:55420dceb8e0 |
---|---|
1 | |
2 #ifndef _GETOPT_H_ | |
3 #define _GETOPT_H_ | |
4 | |
5 #ifdef __cplusplus | |
6 extern "C" { | |
7 #endif | |
8 | |
9 // ================ | |
10 // GETOPT.C Defines | |
11 // ================ | |
12 | |
13 /* | |
14 Types: | |
15 | |
16 P_BOOLEAN : Looks for a + or - immidiately after the option. | |
17 If none found (space or other option), -1 is passed. | |
18 | |
19 P_NUMVALUE : Grabs the value after the option (whitespace ignored). | |
20 If no value is given, -1 is passed. | |
21 | |
22 P_STRING : Grabs the string after the option (leading whitespace | |
23 is ignored). If no string was present, NULL is returned. | |
24 | |
25 Notes: | |
26 | |
27 A filename or string is normally terminated by a space (always a single | |
28 word long). If a filename or string is enclosed in quotations ("blah | |
29 blah"), then the string is not terminated until the closing quote is | |
30 encountered. | |
31 | |
32 */ | |
33 | |
34 typedef struct FILESTACK | |
35 { struct FILESTACK *prev,*next; | |
36 CHAR *path; // full path, including filename | |
37 ULONG size; // Size of the file | |
38 } FILESTACK; | |
39 | |
40 | |
41 typedef struct P_OPTION | |
42 { CHAR *token; // option token (string) | |
43 UBYTE type; // type of option | |
44 } P_OPTION; | |
45 | |
46 | |
47 typedef struct P_PARSE | |
48 { int num; // number of options | |
49 struct P_OPTION *option; // array of options | |
50 } P_PARSE; | |
51 | |
52 | |
53 typedef union P_VALUE | |
54 { SLONG number; // numeric return value | |
55 CHAR *text; // string return value | |
56 } P_VALUE; | |
57 | |
58 #define P_STRING 32 | |
59 #define P_BOOLEAN 64 | |
60 #define P_NUMVALUE 128 | |
61 | |
62 #define EX_FULLSORT 0 | |
63 #define EX_FILESORT 1 | |
64 | |
65 int ngetopt(CHAR *token, P_PARSE *parse, int argc, CHAR *argv[], void (*post)(int, P_VALUE *)); | |
66 BOOL ex_init(CHAR *dir, CHAR *filemask, int sort); | |
67 void ex_exit(void); | |
68 | |
69 extern FILESTACK *filestack; | |
70 extern BOOL sortbydir; // set this to have getopt to catagorize filenames | |
71 // by the way they are given on the command line. | |
72 | |
73 #ifdef __cplusplus | |
74 } | |
75 #endif | |
76 | |
77 #endif | |
78 |