Debian Codegraph @

share/libc/getopt.h

raw
1 /**************************************************************************/
2 /* */
3 /* This file is part of Frama-C. */
4 /* */
5 /* Copyright (C) 2007-2022 */
6 /* CEA (Commissariat à l'énergie atomique et aux énergies */
7 /* alternatives) */
8 /* */
9 /* you can redistribute it and/or modify it under the terms of the GNU */
10 /* Lesser General Public License as published by the Free Software */
11 /* Foundation, version 2.1. */
12 /* */
13 /* It is distributed in the hope that it will be useful, */
14 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
15 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
16 /* GNU Lesser General Public License for more details. */
17 /* */
18 /* See the GNU Lesser General Public License version 2.1 */
19 /* for more details (enclosed in the file licenses/LGPLv2.1). */
20 /* */
21 /**************************************************************************/
22
23 #ifndef __FC_GETOPT_H
24 #define __FC_GETOPT_H
25 #include "features.h"
26 __PUSH_FC_STDLIB
27 #include "unistd.h"
28 __BEGIN_DECLS
29
30
31 /* GNU specific */
32 struct option
33 {
34 const char *name;
35 int has_arg;
36 int *flag;
37 int val;
38 };
39
40 # define no_argument 0
41 # define required_argument 1
42 # define optional_argument 2
43
44
45 /*@
46 assigns \result, *optarg, optind, opterr, optopt, *(longopts[0..].flag)
47 \from argc, argv[0..argc-1], shortopts[0..], longopts[0..];
48 */
49 extern int getopt_long (int argc, char *const argv[],
50 const char *shortopts,
51 const struct option *longopts, int *longind);
52
53 /*@
54 assigns \result, *optarg, optind, opterr, optopt, *(longopts[0..].flag)
55 \from argc, argv[0..argc-1], shortopts[0..], longopts[0..];
56 */
57 extern int getopt_long_only (int argc, char *const argv[],
58 const char *shortopts,
59 const struct option *longopts, int *longind);
60
61 __END_DECLS
62
63 __POP_FC_STDLIB
64 #endif