cmdopt.h
1 #ifndef __COMMAND_LINE_OPTION_H_
2 #define __COMMAND_LINE_OPTION_H_
3
4
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8
9
10
11 typedef struct LongOpt
12 {
13 const char *name;
14
15 int has_arg;
16
17 int *flag;
18
19 int val;
20 } LongOpt, *hLongOpt;
21
22
23 typedef struct CmdOpt
24 {
25
26 int argc;
27 char **argv;
28
29
30 const LongOpt *longopts;
31 const char *optstring;
32
33
34 int optind;
35 char *nextchar;
36 char *optarg;
37 int optopt;
38 char *optlong;
39 int opterr;
40 int longindex;
41 int optnum;
42 } CmdOpt, *hCmdOpt;
43
44
45
46 int CmdOpt_Get( hCmdOpt h );
47
48 void CmdOpt_Init( hCmdOpt h, int argc, char **argv,
49 const char *optstring, const LongOpt *longopts );
50
51
52 #ifdef __cplusplus
53 }
54 #endif
55
56
57 #endif