diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-01-11 11:42:17 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-01-11 11:42:17 +0000 |
commit | ae97a89e1a1a9833080dccc81f6cd26784e1b964 (patch) | |
tree | 6ff1ddc7e3980591c7fd0bbd5d9b8ac82da12886 /libc/unistd/getopt.c | |
parent | abdc3e4d06db2b9d93c509774fc7c4fde918ec8e (diff) |
A large update from Manuel Novoa III <mnovoa3@bellsouth.net>.
Diffstat (limited to 'libc/unistd/getopt.c')
-rw-r--r-- | libc/unistd/getopt.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/libc/unistd/getopt.c b/libc/unistd/getopt.c index 83a9ad69c..a850d9bde 100644 --- a/libc/unistd/getopt.c +++ b/libc/unistd/getopt.c @@ -13,13 +13,18 @@ * and ommision of whitespace between option and arg. */ +/* + * Modified by Manuel Novoa III on 1/5/01 to use weak symbols. + * Programs needing long options will link gnu_getopt instead. + */ + #include <stdio.h> #include <string.h> -int opterr = 1; /* error => print message */ -int optind = 1; /* next argv[] index */ -int optopt = 1; /* Set for unknown arguments */ -char *optarg = NULL; /* option parameter if any */ +int opterr __attribute__ ((__weak__)) = 1; /* error => print message */ +int optind __attribute__ ((__weak__)) = 1; /* next argv[] index */ +int optopt __attribute__ ((__weak__)) = 1; /* Set for unknown arguments */ +char *optarg __attribute__ ((__weak__)) = NULL; /* option parameter if any */ static int Err(name, mess, c) /* returns '?' */ char *name; /* program name argv[0] */ @@ -34,6 +39,9 @@ int c; /* defective option letter */ return '?'; /* erroneous-option marker */ } +extern int getopt (int argc, char *const *argv, const char *optstring) + __attribute__ ((__weak__)); + int getopt (int argc, char *const *argv, const char *optstring) { static int sp = 1; /* position within argument */ |