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