0
|
1 /*
|
|
2 * Simple commandline argument processing function
|
|
3 * Programmed and designed by Matti 'ccr' Hamalainen
|
|
4 * (C) Copyright 2002-2008 Tecnic Software productions (TNSP)
|
|
5 *
|
|
6 * Please read file 'COPYING' for information on license and distribution.
|
|
7 */
|
|
8 #ifndef _TH_ARGS
|
|
9 #define _TH_ARGS
|
|
10
|
|
11 #ifdef __cplusplus
|
|
12 extern "C" {
|
|
13 #endif
|
|
14
|
|
15 #include <stdio.h>
|
|
16 #include "th_util.h"
|
|
17
|
|
18
|
|
19 /* Option flags
|
|
20 */
|
182
|
21 #define OPT_NONE (0) /* Simple option with no arguments */
|
|
22 #define OPT_ARGREQ (1) /* Option's argument is required */
|
|
23 #define OPT_ARGOPT (3) /* Option's argument is optional */
|
81
|
24 #define OPT_ARGMASK (3) /* Mask for option argument flags */
|
182
|
25 #define OPT_REQUIRED (4) /* This option is required to be given */
|
0
|
26
|
|
27
|
|
28 typedef struct {
|
81
|
29 int optID;
|
|
30 char optShort;
|
|
31 char *optLong;
|
|
32 char *optDesc;
|
|
33 int optFlags;
|
0
|
34 } optarg_t;
|
|
35
|
|
36
|
|
37 BOOL th_args_process(int argc, char *argv[],
|
182
|
38 optarg_t argList[], int argListN,
|
|
39 BOOL (*handleOpt)(int, char *, char *),
|
|
40 BOOL (*handleFile)(char *), BOOL);
|
0
|
41
|
182
|
42 void th_args_help(FILE *, optarg_t optList[], int optListN, char *, char *);
|
0
|
43
|
|
44 #ifdef __cplusplus
|
|
45 }
|
|
46 #endif
|
|
47 #endif /* _TH_ARGS */
|