diff options
author | Ulrich Drepper <drepper@gmail.com> | 2011-09-10 14:34:15 -0400 |
---|---|---|
committer | Ulrich Drepper <drepper@gmail.com> | 2011-09-10 14:34:15 -0400 |
commit | 3ce1f2959437e952b9db4eaeed2407424f11a4d1 (patch) | |
tree | db47da854c7d3bfc2c3bce4c6fc8381075ac9ec4 /posix | |
parent | 1248c1c41508387ff282b208636737e8cdc9b5b0 (diff) | |
download | glibc-3ce1f2959437e952b9db4eaeed2407424f11a4d1.tar glibc-3ce1f2959437e952b9db4eaeed2407424f11a4d1.tar.gz glibc-3ce1f2959437e952b9db4eaeed2407424f11a4d1.tar.bz2 glibc-3ce1f2959437e952b9db4eaeed2407424f11a4d1.zip |
Cleanup of configuration options
Make several tool features mandatory and simplify the code.
Diffstat (limited to 'posix')
-rw-r--r-- | posix/getopt.c | 38 | ||||
-rw-r--r-- | posix/wordexp.c | 20 |
2 files changed, 28 insertions, 30 deletions
diff --git a/posix/getopt.c b/posix/getopt.c index 3fa5a4d6d1..ef2b48d366 100644 --- a/posix/getopt.c +++ b/posix/getopt.c @@ -74,7 +74,7 @@ # define _(msgid) gettext (msgid) #endif -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC # include <wchar.h> #endif @@ -583,7 +583,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, first.next = ambig_list; ambig_list = &first; -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC char *buf = NULL; size_t buflen = 0; @@ -652,7 +652,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, { if (print_errors) { -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC char *buf; int n; #endif @@ -660,7 +660,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, if (argv[d->optind - 1][1] == '-') { /* --option */ -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC n = __asprintf (&buf, _("\ %s: option '--%s' doesn't allow an argument\n"), argv[0], pfound->name); @@ -673,7 +673,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, else { /* +option or -option */ -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC n = __asprintf (&buf, _("\ %s: option '%c%s' doesn't allow an argument\n"), argv[0], argv[d->optind - 1][0], @@ -686,7 +686,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, #endif } -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC if (n >= 0) { _IO_flockfile (stderr); @@ -719,7 +719,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, { if (print_errors) { -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC char *buf; if (__asprintf (&buf, _("\ @@ -770,7 +770,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, { if (print_errors) { -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC char *buf; int n; #endif @@ -778,7 +778,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, if (argv[d->optind][1] == '-') { /* --option */ -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC n = __asprintf (&buf, _("%s: unrecognized option '--%s'\n"), argv[0], d->__nextchar); #else @@ -789,7 +789,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, else { /* +option or -option */ -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC n = __asprintf (&buf, _("%s: unrecognized option '%c%s'\n"), argv[0], argv[d->optind][0], d->__nextchar); #else @@ -798,7 +798,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, #endif } -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC if (n >= 0) { _IO_flockfile (stderr); @@ -836,19 +836,19 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, { if (print_errors) { -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC char *buf; int n; #endif -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC n = __asprintf (&buf, _("%s: invalid option -- '%c'\n"), argv[0], c); #else fprintf (stderr, _("%s: invalid option -- '%c'\n"), argv[0], c); #endif -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC if (n >= 0) { _IO_flockfile (stderr); @@ -894,7 +894,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, { if (print_errors) { -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC char *buf; if (__asprintf (&buf, @@ -968,7 +968,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, { if (print_errors) { -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC char *buf; if (__asprintf (&buf, _("%s: option '-W %s' is ambiguous\n"), @@ -1008,7 +1008,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, { if (print_errors) { -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC char *buf; if (__asprintf (&buf, _("\ @@ -1047,7 +1047,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, { if (print_errors) { -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC char *buf; if (__asprintf (&buf, _("\ @@ -1122,7 +1122,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, { if (print_errors) { -#if defined _LIBC && defined USE_IN_LIBIO +#if defined _LIBC char *buf; if (__asprintf (&buf, _("\ diff --git a/posix/wordexp.c b/posix/wordexp.c index 058a7cfbe8..64689d9747 100644 --- a/posix/wordexp.c +++ b/posix/wordexp.c @@ -1,5 +1,5 @@ /* POSIX.2 wordexp implementation. - Copyright (C) 1997-2003, 2005, 2006, 2008 Free Software Foundation, Inc. + Copyright (C) 1997-2003,2005,2006,2008,2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Tim Waugh <tim@cyberelk.demon.co.uk>. @@ -38,9 +38,7 @@ #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> -#ifdef USE_IN_LIBIO -# include <wchar.h> -#endif +#include <wchar.h> #include <wordexp.h> #include <kernel-features.h> @@ -854,7 +852,7 @@ exec_comm_child (char *comm, int *fildes, int showerr, int noexec) __close (fd); } /* Be paranoid. Check that we actually opened the /dev/null - device. */ + device. */ if (__builtin_expect (__fxstat64 (_STAT_VER, STDERR_FILENO, &st), 0) != 0 || __builtin_expect (S_ISCHR (st.st_mode), 1) == 0 #if defined DEV_NULL_MAJOR && defined DEV_NULL_MINOR @@ -862,8 +860,8 @@ exec_comm_child (char *comm, int *fildes, int showerr, int noexec) #endif ) /* It's not the /dev/null device. Stop right here. The - problem is: how do we stop? We use _exit() with an - hopefully unusual exit code. */ + problem is: how do we stop? We use _exit() with an + hopefully unusual exit code. */ _exit (90); } @@ -1062,7 +1060,7 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length, if (copying == 3) { /* Nothing but (IFS) newlines since the last field, - so delimit it here before starting new word */ + so delimit it here before starting new word */ if (w_addword (pwordexp, *word) == WRDE_NOSPACE) goto no_space; @@ -1089,7 +1087,7 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length, /* Ensure we don't go back further than the beginning of the substitution (i.e. remove maxnewlines bytes at most) */ while (maxnewlines-- != 0 && - *word_length > 0 && (*word)[*word_length - 1] == '\n') + *word_length > 0 && (*word)[*word_length - 1] == '\n') { (*word)[--*word_length] = '\0'; @@ -1577,7 +1575,7 @@ envsubst: if (expand_pattern) { /* We need to perform tilde expansion, parameter expansion, - command substitution, and arithmetic expansion. We also + command substitution, and arithmetic expansion. We also have to be a bit careful with wildcard characters, as pattern might be given to fnmatch soon. To do this, we convert quotes to escapes. */ @@ -1982,7 +1980,7 @@ envsubst: field_end = field_begin + strcspn (field_begin, ifs); /* Set up pointer to the character after end of field and - skip whitespace IFS after it. */ + skip whitespace IFS after it. */ next_field = field_end + strspn (field_end, ifs_white); /* Skip at most one non-whitespace IFS character after the field */ |