Mercurial > hg > dmlib
annotate src/dmargs.h @ 1693:ce8d4552ffd5
Get rid of dmGrowBufResize().
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 05 Jun 2018 09:52:53 +0300 |
parents | 7ed25973dbcb |
children | ddec147d1f90 |
rev | line source |
---|---|
0 | 1 /* |
2 * Simple commandline argument processing functions | |
3 * Programmed and designed by Matti 'ccr' Hamalainen | |
863 | 4 * (C) Copyright 2002-2015 Tecnic Software productions (TNSP) |
0 | 5 * |
6 * Please read file 'COPYING' for information on license and distribution. | |
7 */ | |
8 #ifndef DMARGS_H | |
9 #define DMARGS_H | |
10 | |
11 #include "dmlib.h" | |
12 | |
13 #ifdef __cplusplus | |
14 extern "C" { | |
15 #endif | |
16 | |
17 /* Option flags | |
18 */ | |
860
daebbf28953d
The argument handling API in dmargs* was synced with th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
19 #define OPT_NONE (0) // Simple option with no arguments |
daebbf28953d
The argument handling API in dmargs* was synced with th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
20 #define OPT_ARGREQ (1) // Option requires an argument |
daebbf28953d
The argument handling API in dmargs* was synced with th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
21 #define OPT_ARGMASK (1) // Mask for option argument flags |
0 | 22 |
860
daebbf28953d
The argument handling API in dmargs* was synced with th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
23 #define OPTH_BAILOUT 0x0001 // Bail out on errors |
daebbf28953d
The argument handling API in dmargs* was synced with th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
24 #define OPTH_ONLY_OPTS 0x0010 // Handle only options |
daebbf28953d
The argument handling API in dmargs* was synced with th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
25 #define OPTH_ONLY_OTHER 0x0020 // Handle only "non-options" |
daebbf28953d
The argument handling API in dmargs* was synced with th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
26 #define OPTH_ONLY_MASK 0x00f0 // Mask |
daebbf28953d
The argument handling API in dmargs* was synced with th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
27 |
daebbf28953d
The argument handling API in dmargs* was synced with th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
28 |
daebbf28953d
The argument handling API in dmargs* was synced with th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
29 /* Option argument structure |
daebbf28953d
The argument handling API in dmargs* was synced with th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
30 */ |
daebbf28953d
The argument handling API in dmargs* was synced with th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
31 typedef struct |
daebbf28953d
The argument handling API in dmargs* was synced with th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
32 { |
0 | 33 int id; |
34 char optShort; | |
35 char *optLong; | |
36 char *desc; | |
37 int flags; | |
38 } DMOptArg; | |
39 | |
860
daebbf28953d
The argument handling API in dmargs* was synced with th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
40 |
0 | 41 BOOL dmArgsProcess(int argc, char *argv[], |
860
daebbf28953d
The argument handling API in dmargs* was synced with th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
42 const DMOptArg optList[], int noptList, |
daebbf28953d
The argument handling API in dmargs* was synced with th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
43 BOOL (*handleOptionCB)(int, char *, char *), |
daebbf28953d
The argument handling API in dmargs* was synced with th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
44 BOOL (*handleFileCB)(char *), BOOL); |
0 | 45 |
860
daebbf28953d
The argument handling API in dmargs* was synced with th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
46 void dmArgsPrintHelp(FILE *, |
daebbf28953d
The argument handling API in dmargs* was synced with th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
47 const DMOptArg optList[], |
daebbf28953d
The argument handling API in dmargs* was synced with th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
48 const int noptList, |
daebbf28953d
The argument handling API in dmargs* was synced with th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
49 const int flags); |
daebbf28953d
The argument handling API in dmargs* was synced with th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
50 |
0 | 51 |
52 #ifdef __cplusplus | |
53 } | |
54 #endif | |
55 #endif // DMARGS_H |