Debian Codegraph @

include/cli_getopt.h

raw
1 /*
2 * This file is part of the flashrom project.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15 #ifndef __CLI_GETOPT_H__
16 #define __CLI_GETOPT_H__
17
18 /**
19 * This header is responsible for either including a standard getop
20 * implementation header or to provide a compatible one.
21 */
22
23 #ifdef HAVE_GETOPT_H
24 #include <getopt.h>
25 #else
26
27 #define no_argument 0
28 #define required_argument 1
29 #define optional_argument 2
30
31 extern char *optarg;
32 extern int optind, opterr, optopt;
33
34 struct option {
35 const char *name;
36 int has_arg;
37 int *flag;
38 int val;
39 };
40
41 int getopt (int argc, char *const *argv, const char *shortopts);
42 int getopt_long (int argc, char *const *argv, const char *shortopts,
43 const struct option *longopts, int *longind);
44 int getopt_long_only (int argc, char *const *argv, const char *shortopts,
45 const struct option *longopts, int *longind);
46
47 #endif /* HAVE_GETOPT_H */
48 #endif /* __CLI_GETOPT_H__ */