Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
getopt_long.h
1 /*
2  Copied from glibc-2.15
3 
4  Internal declarations for getopt.
5  Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2009
6  Free Software Foundation, Inc.
7  This file is part of the GNU C Library.
8 
9  SPDX-License-Identifier: LGPL-2.0-or-later
10 */
11 
12 #ifndef _GETOPT_INT_H
13 #define _GETOPT_INT_H 1
14 
15 extern int _getopt_internal (int ___argc, char *const *___argv,
16  const char *__shortopts,
17  const struct option *__longopts, int *__longind,
18  int __long_only, int posixly_correct);
19 
20 
21 /* Reentrant versions which can handle parsing multiple argument
22  vectors at the same time. */
23 
24 /* Data type for reentrant functions. */
26 {
27  /* These have exactly the same meaning as the corresponding global
28  variables, except that they are used for the reentrant
29  versions of getopt. */
30  int optind;
31  int opterr;
32  int optopt;
33  char *optarg;
34 
35  /* Internal members. */
36 
37  /* True if the internal members have been initialized. */
38  int __initialized;
39 
40  /* The next char to be scanned in the option-element
41  in which the last option character we returned was found.
42  This allows us to pick up the scan where we left off.
43 
44  If this is zero, or a null string, it means resume the scan
45  by advancing to the next ARGV-element. */
46  char *__nextchar;
47 
48  /* Describe how to deal with options that follow non-option ARGV-elements.
49 
50  If the caller did not specify anything,
51  the default is REQUIRE_ORDER if the environment variable
52  POSIXLY_CORRECT is defined, PERMUTE otherwise.
53 
54  REQUIRE_ORDER means don't recognize them as options;
55  stop option processing when the first non-option is seen.
56  This is what Unix does.
57  This mode of operation is selected by either setting the environment
58  variable POSIXLY_CORRECT, or using `+' as the first character
59  of the list of option characters.
60 
61  PERMUTE is the default. We permute the contents of ARGV as we
62  scan, so that eventually all the non-options are at the end.
63  This allows options to be given in any order, even with programs
64  that were not written to expect this.
65 
66  RETURN_IN_ORDER is an option available to programs that were
67  written to expect options and other ARGV-elements in any order
68  and that care about the ordering of the two. We describe each
69  non-option ARGV-element as if it were the argument of an option
70  with character code 1. Using `-' as the first character of the
71  list of option characters selects this mode of operation.
72 
73  The special argument `--' forces an end of option-scanning regardless
74  of the value of `ordering'. In the case of RETURN_IN_ORDER, only
75  `--' can cause `getopt' to return -1 with `optind' != ARGC. */
76 
77  enum
78  {
79  REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
80  } __ordering;
81 
82  /* If the POSIXLY_CORRECT environment variable is set. */
83  int __posixly_correct;
84 
85 
86  /* Handle permutation of arguments. */
87 
88  /* Describe the part of ARGV that contains non-options that have
89  been skipped. `first_nonopt' is the index in ARGV of the first
90  of them; `last_nonopt' is the index after the last of them. */
91 
92  int __first_nonopt;
93  int __last_nonopt;
94 
95 #if defined _LIBC && defined USE_NONOPTION_FLAGS
96  int __nonoption_flags_max_len;
97  int __nonoption_flags_len;
98 # endif
99 };
100 
101 /* The initializer is necessary to set OPTIND and OPTERR to their
102  default values and to clear the initialization flag. */
103 #define _GETOPT_DATA_INITIALIZER { 1, 1 }
104 
105 extern int _getopt_internal_r (int ___argc, char *const *___argv,
106  const char *__shortopts,
107  const struct option *__longopts, int *__longind,
108  int __long_only, struct _getopt_data *__data,
109  int posixly_correct);
110 
111 extern int _getopt_long_r (int ___argc, char *const *___argv,
112  const char *__shortopts,
113  const struct option *__longopts, int *__longind,
114  struct _getopt_data *__data);
115 
116 extern int _getopt_long_only_r (int ___argc, char *const *___argv,
117  const char *__shortopts,
118  const struct option *__longopts,
119  int *__longind,
120  struct _getopt_data *__data);
121 
122 #endif /* getopt_int.h */
Definition: pcapng.c:148
Definition: getopt_long.h:25