aboutsummaryrefslogtreecommitdiff
path: root/src/util/getopt.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-06-18 14:09:55 +0000
committerChristian Grothoff <christian@grothoff.org>2010-06-18 14:09:55 +0000
commit200aaa0dd6813f19eb7ed67a0fdc301d091fc2d7 (patch)
treef89388586fbf00a3b7c985b2b28bb74abda3a364 /src/util/getopt.c
parent640ae593fd34d27034f994a2e945a8942f1a4d5d (diff)
downloadgnunet-200aaa0dd6813f19eb7ed67a0fdc301d091fc2d7.tar.gz
gnunet-200aaa0dd6813f19eb7ed67a0fdc301d091fc2d7.zip
localization
of scopes
Diffstat (limited to 'src/util/getopt.c')
-rw-r--r--src/util/getopt.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/src/util/getopt.c b/src/util/getopt.c
index 63caa0346..60673af08 100644
--- a/src/util/getopt.c
+++ b/src/util/getopt.c
@@ -135,12 +135,6 @@ static char *GNoptarg = NULL;
135/* 1003.2 says this must be 1 before any call. */ 135/* 1003.2 says this must be 1 before any call. */
136static int GNoptind = 1; 136static int GNoptind = 1;
137 137
138/* Formerly, initialization of getopt depended on GNoptind==0, which
139 causes problems with re-calling getopt as programs generally don't
140 know that. */
141
142static int __getopt_initialized = 0;
143
144/* The next char to be scanned in the option-element 138/* The next char to be scanned in the option-element
145 in which the last option character we returned was found. 139 in which the last option character we returned was found.
146 This allows us to pick up the scan where we left off. 140 This allows us to pick up the scan where we left off.
@@ -150,16 +144,6 @@ static int __getopt_initialized = 0;
150 144
151static char *nextchar; 145static char *nextchar;
152 146
153/* Callers store zero here to inhibit the error message
154 for unrecognized options. */
155
156static int GNopterr = 1;
157
158/* Set to an option character which was unrecognized.
159 This must be initialized on some systems to avoid linking in the
160 system's own getopt implementation. */
161
162static int GNoptopt = '?';
163 147
164/* Describe how to deal with options that follow non-option ARGV-elements. 148/* Describe how to deal with options that follow non-option ARGV-elements.
165 149
@@ -513,14 +497,17 @@ _getopt_initialize (argc, argv, optstring)
513 long-named options. */ 497 long-named options. */
514 498
515static int 499static int
516GN_getopt_internal (argc, argv, optstring, longopts, longind, long_only) 500GN_getopt_internal (int argc,
517 int argc; 501 char *const *argv,
518 char *const *argv; 502 const char *optstring,
519 const char *optstring; 503 const struct GNoption *longopts,
520 const struct GNoption *longopts; 504 int *longind,
521 int *longind; 505 int long_only)
522 int long_only;
523{ 506{
507 static int __getopt_initialized = 0;
508 static int GNopterr = 1;
509 static int GNoptopt = '?';
510
524 GNoptarg = NULL; 511 GNoptarg = NULL;
525 512
526 if (GNoptind == 0 || !__getopt_initialized) 513 if (GNoptind == 0 || !__getopt_initialized)