blob: 06349a1204f60b8fd3c174a398852200002eb631 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#ifndef __FOODOPTS_H
#define __FOODOPTS_H
#include <getopt.h>
/**
* This is a wrapper on getopt.h, specifically
*
* It provides a unified interface for defining
* cli options, printing the help, and looping though
* the parsing results.
*
*/
struct foodoption {
const char *name;
int has_arg;
int *flag;
int val;
/* Extra values */
const char *help;
const char *arg;
const char *category;
};
int
get_foodopt(int argc, char *const argv[],
const char *optstring,
const struct foodoption *longopts,
int *longindex);
const char *
get_argument(const char opt,
const struct foodoption *longopts);
void
foodopt_help(char * argv0,
const struct foodoption *longopts);
#endif /* __FOODOPTS_H */
|