projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
.
[gnulib.git]
/
lib
/
getopt.c
diff --git
a/lib/getopt.c
b/lib/getopt.c
index
1af2a96
..
8bcf559
100644
(file)
--- a/
lib/getopt.c
+++ b/
lib/getopt.c
@@
-59,12
+59,15
@@
#include <stdlib.h>
#endif /* GNU C library. */
#include <stdlib.h>
#endif /* GNU C library. */
+#ifndef _
/* This is for other GNU distributions with internationalized messages.
/* This is for other GNU distributions with internationalized messages.
-
The GNU C Library itself does not yet support such messages
. */
-#if HAVE_LIBINTL_H
+
When compiling libc, the _ macro is predefined
. */
+#if
def
HAVE_LIBINTL_H
# include <libintl.h>
# include <libintl.h>
+# define _(msgid) gettext (msgid)
#else
#else
-# define gettext(msgid) (msgid)
+# define _(msgid) (msgid)
+#endif
#endif
/* This version of `getopt' appears to the caller like standard Unix `getopt'
#endif
/* This version of `getopt' appears to the caller like standard Unix `getopt'
@@
-521,7
+524,7
@@
_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
if (ambig && !exact)
{
if (opterr)
if (ambig && !exact)
{
if (opterr)
- fprintf (stderr,
gettext
("%s: option `%s' is ambiguous\n"),
+ fprintf (stderr,
_
("%s: option `%s' is ambiguous\n"),
argv[0], argv[optind]);
nextchar += strlen (nextchar);
optind++;
argv[0], argv[optind]);
nextchar += strlen (nextchar);
optind++;
@@
-544,12
+547,12
@@
_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
if (argv[optind - 1][1] == '-')
/* --option */
fprintf (stderr,
if (argv[optind - 1][1] == '-')
/* --option */
fprintf (stderr,
-
gettext
("%s: option `--%s' doesn't allow an argument\n"),
+
_
("%s: option `--%s' doesn't allow an argument\n"),
argv[0], pfound->name);
else
/* +option or -option */
fprintf (stderr,
argv[0], pfound->name);
else
/* +option or -option */
fprintf (stderr,
-
gettext
("%s: option `%c%s' doesn't allow an argument\n"),
+
_
("%s: option `%c%s' doesn't allow an argument\n"),
argv[0], argv[optind - 1][0], pfound->name);
nextchar += strlen (nextchar);
argv[0], argv[optind - 1][0], pfound->name);
nextchar += strlen (nextchar);
@@
-564,7
+567,7
@@
_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
{
if (opterr)
fprintf (stderr,
{
if (opterr)
fprintf (stderr,
-
gettext
("%s: option `%s' requires an argument\n"),
+
_
("%s: option `%s' requires an argument\n"),
argv[0], argv[optind - 1]);
nextchar += strlen (nextchar);
return optstring[0] == ':' ? ':' : '?';
argv[0], argv[optind - 1]);
nextchar += strlen (nextchar);
return optstring[0] == ':' ? ':' : '?';
@@
-592,11
+595,11
@@
_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
{
if (argv[optind][1] == '-')
/* --option */
{
if (argv[optind][1] == '-')
/* --option */
- fprintf (stderr,
gettext
("%s: unrecognized option `--%s'\n"),
+ fprintf (stderr,
_
("%s: unrecognized option `--%s'\n"),
argv[0], nextchar);
else
/* +option or -option */
argv[0], nextchar);
else
/* +option or -option */
- fprintf (stderr,
gettext
("%s: unrecognized option `%c%s'\n"),
+ fprintf (stderr,
_
("%s: unrecognized option `%c%s'\n"),
argv[0], argv[optind][0], nextchar);
}
nextchar = (char *) "";
argv[0], argv[optind][0], nextchar);
}
nextchar = (char *) "";
@@
-621,10
+624,10
@@
_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
{
if (posixly_correct)
/* 1003.2 specifies the format of this message. */
{
if (posixly_correct)
/* 1003.2 specifies the format of this message. */
- fprintf (stderr,
gettext
("%s: illegal option -- %c\n"),
+ fprintf (stderr,
_
("%s: illegal option -- %c\n"),
argv[0], c);
else
argv[0], c);
else
- fprintf (stderr,
gettext
("%s: invalid option -- %c\n"),
+ fprintf (stderr,
_
("%s: invalid option -- %c\n"),
argv[0], c);
}
optopt = c;
argv[0], c);
}
optopt = c;
@@
-660,7
+663,7
@@
_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
{
/* 1003.2 specifies the format of this message. */
fprintf (stderr,
{
/* 1003.2 specifies the format of this message. */
fprintf (stderr,
-
gettext
("%s: option requires an argument -- %c\n"),
+
_
("%s: option requires an argument -- %c\n"),
argv[0], c);
}
optopt = c;
argv[0], c);
}
optopt = c;