comparison th_args.h @ 0:728243125263

Import.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 20 Mar 2008 00:15:03 +0000
parents
children 69aed051f84d
comparison
equal deleted inserted replaced
-1:000000000000 0:728243125263
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 */
21 #define OPT_NONE (0) /* Simple option with no arguments */
22
23 #define OPT_ARGREQ (1) /* Option's argument is required */
24 #define OPT_ARGOPT (3) /* Option's argument is optional */
25 #define OPT_ARGMASK (3) /* Mask for option argument flags */
26
27 #define OPT_REQUIRED (4) /* This option is required to be given */
28
29
30 typedef struct {
31 int optID;
32 char optShort;
33 char *optLong;
34 char *optDesc;
35 int optFlags;
36 } optarg_t;
37
38
39 BOOL th_args_process(int argc, char *argv[],
40 optarg_t argList[], int argListN,
41 BOOL (*handleOpt)(int, char *, char *),
42 BOOL (*handleFile)(char *), BOOL);
43
44 void th_args_help(FILE *, optarg_t optList[], int optListN,
45 char *, char *);
46
47 #ifdef __cplusplus
48 }
49 #endif
50 #endif /* _TH_ARGS */