diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-06-06 03:24:45 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-06-06 03:24:45 +0000 |
commit | 5680095d5dc3b040e4ad67da43e3ac7194682361 (patch) | |
tree | 2cb1bbb6486b0cc848509b13c4f6a655b9ca50cb /libc | |
parent | 3e0c11bdce88bb7d4f3408fe332580669163a0da (diff) |
shrink getopt a bit by using smallints. Run tested (busybox testsuite)
text data bss dec hex filename
- 2403 12 40 2455 997 libc/unistd/getopt.o
+ 2388 12 28 2428 97c libc/unistd/getopt.o
Diffstat (limited to 'libc')
-rw-r--r-- | libc/unistd/getopt_int.h | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/libc/unistd/getopt_int.h b/libc/unistd/getopt_int.h index e2a005db9..5637c109f 100644 --- a/libc/unistd/getopt_int.h +++ b/libc/unistd/getopt_int.h @@ -30,7 +30,13 @@ extern int _getopt_internal (int ___argc, char *const *___argv, /* Reentrant versions which can handle parsing multiple argument vectors at the same time. */ +/* For __ordering member */ +enum { + REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER +}; + /* Data type for reentrant functions. */ + struct _getopt_data { /* These have exactly the same meaning as the corresponding global @@ -38,21 +44,13 @@ struct _getopt_data versions of getopt. */ int optind; int opterr; - int optopt; char *optarg; + smalluint optopt; /* we store characters here, a byte is enough */ /* Internal members. */ /* True if the internal members have been initialized. */ - int __initialized; - - /* The next char to be scanned in the option-element - in which the last option character we returned was found. - This allows us to pick up the scan where we left off. - - If this is zero, or a null string, it means resume the scan - by advancing to the next ARGV-element. */ - char *__nextchar; + smallint __initialized; /* Describe how to deal with options that follow non-option ARGV-elements. @@ -82,14 +80,18 @@ struct _getopt_data The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return -1 with `optind' != ARGC. */ - - enum - { - REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER - } __ordering; + smallint __ordering; /* If the POSIXLY_CORRECT environment variable is set. */ - int __posixly_correct; + smallint __posixly_correct; + + /* The next char to be scanned in the option-element + in which the last option character we returned was found. + This allows us to pick up the scan where we left off. + + If this is zero, or a null string, it means resume the scan + by advancing to the next ARGV-element. */ + char *__nextchar; /* Handle permutation of arguments. */ |