diff options
author | Ulrich Drepper <drepper@redhat.com> | 2008-03-08 20:04:40 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2008-03-08 20:04:40 +0000 |
commit | 2127a18634b03df94c69900765c3a44016251d93 (patch) | |
tree | 17a63c41ec43cfc5c8f02de6f05f3b3d3b21a930 /posix/getopt.c | |
parent | 725c0c87926abdc5f7b2fee52132d9ec82d64ac3 (diff) | |
download | glibc-2127a18634b03df94c69900765c3a44016251d93.zip glibc-2127a18634b03df94c69900765c3a44016251d93.tar.gz glibc-2127a18634b03df94c69900765c3a44016251d93.tar.bz2 |
[BZ #5762]
* posix/getopt.c (_getopt_internal_r): Clarify error message by
putting offending option character in quotes. Clean up error
messages.
* po/be.po: Adjust msgstr in translation file.
* po/bg.po: Likewise.
* po/ca.po: Likewise.
* po/cs.po: Likewise.
* po/da.po: Likewise.
* po/de.po: Likewise.
* po/es.po: Likewise.
* po/fr.po: Likewise.
* po/hr.po: Likewise.
* po/ko.po: Likewise.
* po/nl.po: Likewise.
* po/rw.po: Likewise.
* po/sk.po: Likewise.
* po/sv.po: Likewise.
* po/tr.po: Likewise.
* po/zh_CN.po: Likewise.
* po/zh_TW.po: Likewise.
Diffstat (limited to 'posix/getopt.c')
-rw-r--r-- | posix/getopt.c | 65 |
1 files changed, 32 insertions, 33 deletions
diff --git a/posix/getopt.c b/posix/getopt.c index b1cecd3..103f572 100644 --- a/posix/getopt.c +++ b/posix/getopt.c @@ -1,9 +1,8 @@ /* Getopt for GNU. - NOTE: getopt is now part of the C library, so if you don't know what + NOTE: getopt is part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! - Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004 - Free Software Foundation, Inc. + Copyright (C) 1987-1996,1998-2004,2008 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -568,7 +567,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, #if defined _LIBC && defined USE_IN_LIBIO char *buf; - if (__asprintf (&buf, _("%s: option `%s' is ambiguous\n"), + if (__asprintf (&buf, _("%s: option '%s' is ambiguous\n"), argv[0], argv[d->optind]) >= 0) { _IO_flockfile (stderr); @@ -584,7 +583,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, free (buf); } #else - fprintf (stderr, _("%s: option `%s' is ambiguous\n"), + fprintf (stderr, _("%s: option '%s' is ambiguous\n"), argv[0], argv[d->optind]); #endif } @@ -618,11 +617,11 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, /* --option */ #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("\ -%s: option `--%s' doesn't allow an argument\n"), +%s: option '--%s' doesn't allow an argument\n"), argv[0], pfound->name); #else fprintf (stderr, _("\ -%s: option `--%s' doesn't allow an argument\n"), +%s: option '--%s' doesn't allow an argument\n"), argv[0], pfound->name); #endif } @@ -631,12 +630,12 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, /* +option or -option */ #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("\ -%s: option `%c%s' doesn't allow an argument\n"), +%s: option '%c%s' doesn't allow an argument\n"), argv[0], argv[d->optind - 1][0], pfound->name); #else fprintf (stderr, _("\ -%s: option `%c%s' doesn't allow an argument\n"), +%s: option '%c%s' doesn't allow an argument\n"), argv[0], argv[d->optind - 1][0], pfound->name); #endif @@ -679,7 +678,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, char *buf; if (__asprintf (&buf, _("\ -%s: option `%s' requires an argument\n"), +%s: option '%s' requires an argument\n"), argv[0], argv[d->optind - 1]) >= 0) { _IO_flockfile (stderr); @@ -697,7 +696,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, } #else fprintf (stderr, - _("%s: option `%s' requires an argument\n"), + _("%s: option '%s' requires an argument\n"), argv[0], argv[d->optind - 1]); #endif } @@ -735,10 +734,10 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, { /* --option */ #if defined _LIBC && defined USE_IN_LIBIO - n = __asprintf (&buf, _("%s: unrecognized option `--%s'\n"), + n = __asprintf (&buf, _("%s: unrecognized option '--%s'\n"), argv[0], d->__nextchar); #else - fprintf (stderr, _("%s: unrecognized option `--%s'\n"), + fprintf (stderr, _("%s: unrecognized option '--%s'\n"), argv[0], d->__nextchar); #endif } @@ -746,10 +745,10 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, { /* +option or -option */ #if defined _LIBC && defined USE_IN_LIBIO - n = __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"), + n = __asprintf (&buf, _("%s: unrecognized option '%c%s'\n"), argv[0], argv[d->optind][0], d->__nextchar); #else - fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), + fprintf (stderr, _("%s: unrecognized option '%c%s'\n"), argv[0], argv[d->optind][0], d->__nextchar); #endif } @@ -799,21 +798,22 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, if (d->__posixly_correct) { - /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO - n = __asprintf (&buf, _("%s: illegal option -- %c\n"), + n = __asprintf (&buf, _("%s: illegal option -- '%c'\n"), argv[0], c); #else - fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c); + fprintf (stderr, _("%s: illegal option -- '%c'\n"), argv[0], + c); #endif } else { #if defined _LIBC && defined USE_IN_LIBIO - n = __asprintf (&buf, _("%s: invalid option -- %c\n"), + n = __asprintf (&buf, _("%s: invalid option -- '%c'\n"), argv[0], c); #else - fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c); + fprintf (stderr, _("%s: invalid option -- '%c'\n"), argv[0], + c); #endif } @@ -860,12 +860,11 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, { if (print_errors) { - /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, - _("%s: option requires an argument -- %c\n"), + _("%s: option requires an argument -- '%c'\n"), argv[0], c) >= 0) { _IO_flockfile (stderr); @@ -881,7 +880,8 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, free (buf); } #else - fprintf (stderr, _("%s: option requires an argument -- %c\n"), + fprintf (stderr, + _("%s: option requires an argument -- '%c'\n"), argv[0], c); #endif } @@ -934,7 +934,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, #if defined _LIBC && defined USE_IN_LIBIO char *buf; - if (__asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"), + if (__asprintf (&buf, _("%s: option '-W %s' is ambiguous\n"), argv[0], argv[d->optind]) >= 0) { _IO_flockfile (stderr); @@ -950,7 +950,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, free (buf); } #else - fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), + fprintf (stderr, _("%s: option '-W %s' is ambiguous\n"), argv[0], argv[d->optind]); #endif } @@ -975,7 +975,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, char *buf; if (__asprintf (&buf, _("\ -%s: option `-W %s' doesn't allow an argument\n"), +%s: option '-W %s' doesn't allow an argument\n"), argv[0], pfound->name) >= 0) { _IO_flockfile (stderr); @@ -993,7 +993,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, } #else fprintf (stderr, _("\ -%s: option `-W %s' doesn't allow an argument\n"), +%s: option '-W %s' doesn't allow an argument\n"), argv[0], pfound->name); #endif } @@ -1014,7 +1014,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, char *buf; if (__asprintf (&buf, _("\ -%s: option `%s' requires an argument\n"), +%s: option '%s' requires an argument\n"), argv[0], argv[d->optind - 1]) >= 0) { _IO_flockfile (stderr); @@ -1032,7 +1032,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, } #else fprintf (stderr, - _("%s: option `%s' requires an argument\n"), + _("%s: option '%s' requires an argument\n"), argv[0], argv[d->optind - 1]); #endif } @@ -1081,12 +1081,11 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, { if (print_errors) { - /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("\ -%s: option requires an argument -- %c\n"), +%s: option requires an argument -- '%c'\n"), argv[0], c) >= 0) { _IO_flockfile (stderr); @@ -1103,7 +1102,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, } #else fprintf (stderr, - _("%s: option requires an argument -- %c\n"), + _("%s: option requires an argument -- '%c'\n"), argv[0], c); #endif } @@ -1200,7 +1199,7 @@ main (int argc, char **argv) break; case 'c': - printf ("option c with value `%s'\n", optarg); + printf ("option c with value '%s'\n", optarg); break; case '?': |