This is the mail archive of the
glibc-cvs@sources.redhat.com
mailing list for the glibc project.
libc/posix getopt.c
- From: drepper at sources dot redhat dot com
- To: glibc-cvs at sources dot redhat dot com
- Date: 9 Mar 2004 10:34:58 -0000
- Subject: libc/posix getopt.c
CVSROOT: /cvs/glibc
Module name: libc
Changes by: drepper@sourceware.org 2004-03-09 10:34:58
Modified files:
posix : getopt.c
Log message:
Include "getopt_int.h".
(__getopt_initialized): Variable removed.
(nextchar, ordering, posixly_correct, first_nonopt, last_nonopt):
Static variables removed.
(nonoption_flags_max_len, nonoption_flags_len) [_LIBC &&
USE_NONOPTION_FLAGS]: Static variables removed.
(getopt_data): New static variable.
(SWAP_FLAGS): Use d->__nonoption_flags_len instead
nonoption_flags_len.
(exchange): Add new argument D of type struct getopt_data *.
Replace optind with d->optind, optarg with d->optarg, opterr with
d->opterr, optopt with d->optopt, nextchar with d->__nextchar,
first_nonopt with d->__first_nonopt, last_nonopt with
d->__last_nonopt, d->ordering with d->__ordering,
d->posixly_correct with d->__posixly_correct (which is now an
int instead a string, so fix users), nonoption_flags_len
with d->__nonoption_flags_len, nonoption_flags_max_len with
d->__nonoption_flags_max_len.
(_getopt_initialize): Likewise.
(_getopt_internal): Rename to ...
(_getopt_internal_r): ... this. Also add new argument D of type
struct getopt_data * and use of members of D rather than global or
static variables as described for exchange() above. Add new argument
to invocations of _getopt_initialize and exchange.
(_getopt_internal): Reimplement in terms of _getopt_internal_r.
(const): Remove.
(exchange, _getopt_initialize, _getopt_internal_r, _getopt_internal,
getopt, main): Use prototypes, not old-style definitions.
!defined VMS || !HAVE_STRING_H]:
Include <string.h> regardless. No need for <strings.h>.
[!defined _LIBC]: Include "gettext.h" rather than rolling it ourselves.
(_): Define to gettext always.
(my_index): Remove: all uses changed to strchr.
(strlen): Remove decl.