[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gnulib] Re: [PATCH] getopt, argp - reentrant getopt interface, argp

From: Marcus Brinkmann
Subject: [Bug-gnulib] Re: [PATCH] getopt, argp - reentrant getopt interface, argp fixes
Date: Sat, 06 Mar 2004 21:37:55 +0100
User-agent: Wanderlust/2.10.1 (Watching The Wheels) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/21.3 (i386-pc-linux-gnu) MULE/5.0 (SAKAKI)

Small glitch in the changelog fixed, please use the ChangeLog entry below.


2004-03-06  Marcus Brinkmann  <address@hidden>

        * posix/getopt.h (struct _getopt_data) [!__need_getopt]: New structure.
        (_GETOPT_DATA_INITIALIZER) [!__need_getopt]: New macro.
        (_getopt_internal_r) [!__need_getopt]: New declaration.
        * posix/getopt.c (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
        (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
        (_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.
        * posix/getopt1.c: Remove libc_hidden_def for getopt_long and
        (__getopt_long_r, __getopt_long_only_r): New functions.
        * include/getopt.h: Remove libc_hidden_proto for getopt_long and
        (__getopt_long_r, __getopt_long_only_r): New prototypes.
        * argp/argp-parse.c [_LIBC]: Do not include <bits/libc-lock.h>.
        [!_LIBC && HAVE_CTHREADS_H]: Do not include <cthreads.h>.
        [!_LIBC] (_argp_hang): Make static.
        (getopt_lock, LOCK_GETOPT, UNLOCK_GETOPT): Remove.
        (_argp_unlock_xxx): Remove.
        (parser_init): Do not use LOCK_GETOPT.
        (parser_finalize): Do not use UNLOCK_GETOPT.
        (struct parser): New member OPT_DATA.
        (parser_init): Initialize parser->opt_data.  Use
        parser->opt_data.opterr instead of opterr.
        (parser_parse_opt): Use parser->opt_data.optarg instead optarg.
        (parser_parse_next): Likewise.  Use parser->opt_data.optind
        instead optind.  Use parser->opt_data.optopt instead of optopt.
        Call __getopt_long_only_r and __getopt_long_r instead of
        getopt_long_only and getopt_long, and pass the extra argument.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]