about summary refs log tree commit diff
path: root/argp/argp-parse.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-03-06 12:45:08 +0000
committerUlrich Drepper <drepper@redhat.com>1998-03-06 12:45:08 +0000
commit9184d3db100aff82d081a70442842344da84cf4b (patch)
treea00b4a406480b3afcfcf447bc41aa4bbaeadb830 /argp/argp-parse.c
parentac16e90592f0b9842e193e2ebe0b3756f0b4361d (diff)
downloadglibc-9184d3db100aff82d081a70442842344da84cf4b.tar.gz
glibc-9184d3db100aff82d081a70442842344da84cf4b.tar.xz
glibc-9184d3db100aff82d081a70442842344da84cf4b.zip
Update.
1998-03-06 12:42  Ulrich Drepper  <drepper@cygnus.com>

	* argp/argp.h (struct argp): Add new field domain.
	* argp/argp-help.c: Change all gettext calls to dgettext and use
	domain field from appropriate argp in call.
	* argp/argp-parse.c: Likewise.
Diffstat (limited to 'argp/argp-parse.c')
-rw-r--r--argp/argp-parse.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/argp/argp-parse.c b/argp/argp-parse.c
index 553dd88552..e2ddd6d361 100644
--- a/argp/argp-parse.c
+++ b/argp/argp-parse.c
@@ -1,5 +1,5 @@
 /* Hierarchial argument parsing, layered over getopt
-   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <miles@gnu.ai.mit.edu>.
 
@@ -33,9 +33,8 @@
    When compiling libc, the _ macro is predefined.  */
 #ifdef HAVE_LIBINTL_H
 # include <libintl.h>
-# define _(msgid)       gettext (msgid)
 #else
-# define _(msgid)       (msgid)
+# define dgettext(domain, msgid) (msgid)
 # define gettext(msgid) (msgid)
 #endif
 #define N_(msgid) (msgid)
@@ -161,7 +160,8 @@ argp_version_parser (int key, char *arg, struct argp_state *state)
       else if (argp_program_version)
 	fprintf (state->out_stream, "%s\n", argp_program_version);
       else
-	__argp_error (state, _("(PROGRAM ERROR) No version known!?"));
+	__argp_error (state, dgettext (state->root_argp->argp_domain,
+				       "(PROGRAM ERROR) No version known!?"));
       if (! (state->flags & ARGP_NO_EXIT))
 	exit (0);
       break;
@@ -634,7 +634,8 @@ parser_finalize (struct parser *parser,
       {
 	if (!(parser->state.flags & ARGP_NO_ERRS) && parser->state.err_stream)
 	  fprintf (parser->state.err_stream,
-		   _("%s: Too many arguments\n"), parser->state.name);
+		   dgettext (parser->argp->argp_domain,
+			     "%s: Too many arguments\n"), parser->state.name);
 	err = EBADKEY;
       }
 
@@ -775,7 +776,8 @@ parser_parse_opt (struct parser *parser, int opt, char *val)
       static const char bad_key_err[] =
 	N_("(PROGRAM ERROR) Option should have been recognized!?");
       if (group_key == 0)
-	__argp_error (&parser->state, "-%c: %s", opt, _(bad_key_err));
+	__argp_error (&parser->state, "-%c: %s", opt,
+		      dgettext (parser->argp->argp_domain, bad_key_err));
       else
 	{
 	  struct option *long_opt = parser->long_opts;
@@ -783,9 +785,9 @@ parser_parse_opt (struct parser *parser, int opt, char *val)
 	    long_opt++;
 	  __argp_error (&parser->state, "--%s: %s",
 			long_opt->name ? long_opt->name : "???",
-			_(bad_key_err));
+			dgettext (parser->argp->argp_domain, bad_key_err));
 	}
-    }	
+    }
 
   return err;
 }
@@ -867,7 +869,7 @@ parser_parse_next (struct parser *parser, int *arg_ebadkey)
     err = parser_parse_arg (parser, optarg);
   else
     err = parser_parse_opt (parser, opt, optarg);
-		      
+
   if (err == EBADKEY)
     *arg_ebadkey = (opt == KEY_END || opt == KEY_ARG);