diff options
author | wlemb <wlemb> | 2002-03-28 15:30:35 +0000 |
---|---|---|
committer | wlemb <wlemb> | 2002-03-28 15:30:35 +0000 |
commit | ea73dc4b396b8aea506153fb5e4780fd57a5abf5 (patch) | |
tree | fa42500322e27b763cde6e6e7c2188a132f8a076 | |
parent | e56eea48e6e5abce2f90294165b99ddfdcb00123 (diff) | |
download | groff-ea73dc4b396b8aea506153fb5e4780fd57a5abf5.tar.gz |
* src/libs/libgroff/getopt.c: Updated to latest version.
* tmac/README: More on hyphen.tex license.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | src/libs/libgroff/getopt.c | 205 | ||||
-rw-r--r-- | tmac/README | 22 |
3 files changed, 140 insertions, 93 deletions
@@ -1,3 +1,9 @@ +2002-03-28 Werner LEMBERG <wl@gnu.org> + + * src/libs/libgroff/getopt.c: Updated to latest version. + + * tmac/README: More on hyphen.tex license. + 2002-03-26 Larry Kollar <kollar@alltel.net> * doc/groff.texinfo: Add documentation of most missing requests. diff --git a/src/libs/libgroff/getopt.c b/src/libs/libgroff/getopt.c index df7127e4..289d137e 100644 --- a/src/libs/libgroff/getopt.c +++ b/src/libs/libgroff/getopt.c @@ -2,7 +2,7 @@ NOTE: getopt is now 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 + Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -78,7 +78,7 @@ #ifndef _ /* This is for other GNU distributions with internationalized messages. */ -# if defined HAVE_LIBINTL_H || defined _LIBC +# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC # include <libintl.h> # ifndef _ # define _(msgid) gettext (msgid) @@ -91,6 +91,10 @@ # endif #endif +#ifndef attribute_hidden +# define attribute_hidden +#endif + /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. @@ -134,7 +138,7 @@ int optind = 1; causes problems with re-calling getopt as programs generally don't know that. */ -int __getopt_initialized; +int __getopt_initialized attribute_hidden; /* The next char to be scanned in the option-element in which the last option character we returned was found. @@ -685,15 +689,17 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) #if defined _LIBC && defined USE_IN_LIBIO char *buf; - __asprintf (&buf, _("%s: option `%s' is ambiguous\n"), - argv[0], argv[optind]); + if (__asprintf (&buf, _("%s: option `%s' is ambiguous\n"), + argv[0], argv[optind]) >= 0) + { - if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s", buf); - else - fputs (buf, stderr); + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s", buf); + else + fputs (buf, stderr); - free (buf); + free (buf); + } #else fprintf (stderr, _("%s: option `%s' is ambiguous\n"), argv[0], argv[optind]); @@ -721,15 +727,16 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; + int n; #endif if (argv[optind - 1][1] == '-') { /* --option */ #if defined _LIBC && defined USE_IN_LIBIO - __asprintf (&buf, _("\ + n = __asprintf (&buf, _("\ %s: option `--%s' doesn't allow an argument\n"), - argv[0], pfound->name); + argv[0], pfound->name); #else fprintf (stderr, _("\ %s: option `--%s' doesn't allow an argument\n"), @@ -740,10 +747,10 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) { /* +option or -option */ #if defined _LIBC && defined USE_IN_LIBIO - __asprintf (&buf, _("\ + n = __asprintf (&buf, _("\ %s: option `%c%s' doesn't allow an argument\n"), - argv[0], argv[optind - 1][0], - pfound->name); + argv[0], argv[optind - 1][0], + pfound->name); #else fprintf (stderr, _("\ %s: option `%c%s' doesn't allow an argument\n"), @@ -752,12 +759,15 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) } #if defined _LIBC && defined USE_IN_LIBIO - if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s", buf); - else - fputs (buf, stderr); + if (n >= 0) + { + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s", buf); + else + fputs (buf, stderr); - free (buf); + free (buf); + } #endif } @@ -778,16 +788,17 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) #if defined _LIBC && defined USE_IN_LIBIO char *buf; - __asprintf (&buf, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - - if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s", buf); - else - fputs (buf, stderr); + if (__asprintf (&buf, _("\ +%s: option `%s' requires an argument\n"), + argv[0], argv[optind - 1]) >= 0) + { + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s", buf); + else + fputs (buf, stderr); - free (buf); + free (buf); + } #else fprintf (stderr, _("%s: option `%s' requires an argument\n"), @@ -821,14 +832,15 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; + int n; #endif if (argv[optind][1] == '-') { /* --option */ #if defined _LIBC && defined USE_IN_LIBIO - __asprintf (&buf, _("%s: unrecognized option `--%s'\n"), - argv[0], nextchar); + n = __asprintf (&buf, _("%s: unrecognized option `--%s'\n"), + argv[0], nextchar); #else fprintf (stderr, _("%s: unrecognized option `--%s'\n"), argv[0], nextchar); @@ -838,8 +850,8 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) { /* +option or -option */ #if defined _LIBC && defined USE_IN_LIBIO - __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"), - argv[0], argv[optind][0], nextchar); + n = __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"), + argv[0], argv[optind][0], nextchar); #else fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), argv[0], argv[optind][0], nextchar); @@ -847,12 +859,15 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) } #if defined _LIBC && defined USE_IN_LIBIO - if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s", buf); - else - fputs (buf, stderr); + if (n >= 0) + { + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s", buf); + else + fputs (buf, stderr); - free (buf); + free (buf); + } #endif } nextchar = (char *) ""; @@ -878,14 +893,15 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; + int n; #endif if (posixly_correct) { /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO - __asprintf (&buf, _("%s: illegal option -- %c\n"), - argv[0], c); + n = __asprintf (&buf, _("%s: illegal option -- %c\n"), + argv[0], c); #else fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c); #endif @@ -893,20 +909,23 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) else { #if defined _LIBC && defined USE_IN_LIBIO - __asprintf (&buf, _("%s: invalid option -- %c\n"), - argv[0], c); + 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 (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s", buf); - else - fputs (buf, stderr); + if (n >= 0) + { + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s", buf); + else + fputs (buf, stderr); - free (buf); + free (buf); + } #endif } optopt = c; @@ -939,15 +958,17 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) #if defined _LIBC && defined USE_IN_LIBIO char *buf; - __asprintf (&buf, _("%s: option requires an argument -- %c\n"), - argv[0], c); - - if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s", buf); - else - fputs (buf, stderr); + if (__asprintf (&buf, + _("%s: option requires an argument -- %c\n"), + argv[0], c) >= 0) + { + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s", buf); + else + fputs (buf, stderr); - free (buf); + free (buf); + } #else fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); @@ -1001,15 +1022,16 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) #if defined _LIBC && defined USE_IN_LIBIO char *buf; - __asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"), - argv[0], argv[optind]); - - if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s", buf); - else - fputs (buf, stderr); + if (__asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"), + argv[0], argv[optind]) >= 0) + { + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s", buf); + else + fputs (buf, stderr); - free (buf); + free (buf); + } #else fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[optind]); @@ -1035,16 +1057,17 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) #if defined _LIBC && defined USE_IN_LIBIO char *buf; - __asprintf (&buf, _("\ + if (__asprintf (&buf, _("\ %s: option `-W %s' doesn't allow an argument\n"), - argv[0], pfound->name); - - if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s", buf); - else - fputs (buf, stderr); - - free (buf); + argv[0], pfound->name) >= 0) + { + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s", buf); + else + fputs (buf, stderr); + + free (buf); + } #else fprintf (stderr, _("\ %s: option `-W %s' doesn't allow an argument\n"), @@ -1067,16 +1090,17 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) #if defined _LIBC && defined USE_IN_LIBIO char *buf; - __asprintf (&buf, _("\ + if (__asprintf (&buf, _("\ %s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - - if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s", buf); - else - fputs (buf, stderr); - - free (buf); + argv[0], argv[optind - 1]) >= 0) + { + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s", buf); + else + fputs (buf, stderr); + + free (buf); + } #else fprintf (stderr, _("%s: option `%s' requires an argument\n"), @@ -1132,16 +1156,17 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) #if defined _LIBC && defined USE_IN_LIBIO char *buf; - __asprintf (&buf, - _("%s: option requires an argument -- %c\n"), - argv[0], c); - - if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s", buf); - else - fputs (buf, stderr); + if (__asprintf (&buf, _("\ +%s: option requires an argument -- %c\n"), + argv[0], c) >= 0) + { + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s", buf); + else + fputs (buf, stderr); - free (buf); + free (buf); + } #else fprintf (stderr, _("%s: option requires an argument -- %c\n"), diff --git a/tmac/README b/tmac/README index d91f77da..ee77dd38 100644 --- a/tmac/README +++ b/tmac/README @@ -1,4 +1,20 @@ The file `hyphen.us' is identical to the file `hyphen.tex', part of the TeX -system written by Donald E. Knuth. It has been renamed for consistency, -i.e., to make patterns available under the filenames `hyphen.<language>', -e.g. `hyphen.de' or `hyphen.uk'. +system written by Donald E. Knuth;the master file can be found at + + ftp://labrea.stanford.edu/pub/tex/dist/lib/hyphen.tex . + +It has been renamed for consistency, i.e., to make patterns available under +the filenames `hyphen.<language>', e.g. `hyphen.de' or `hyphen.uk'. + +From the file ftp://labrea.stanford.edu/tex/README; `hyphen.tex' is also in +this directory: + + The files in this directory are master files maintained personally by + Donald E. Knuth. Nobody else is authorized to make any changes whatever + to them! If you modify the files for any purpose, you must give your + files a different name, so that installations of TeX throughout the + world will be 100% compatible when they use the official source files. + + All of the files here are available for anonymous FTP by anyone and may + be freely redistributed. Some are copyrighted; see the files themselves + for more details. |