Project Info Name.......: gnu-hello
Description: GNU Hello


gnu-hello       
Info
Commit...:7c2fde45b2eac4a7300ebb0122c9ba6775d5ef46
Author...:karl <>
Committer:karl <>
Date.....:Thu Nov 9 18:46:10 2006 +0000
Parents..:8759b16bb037e80ff173059e45d7c1ddb0d375c6

Message
[project @ 2006-11-09 18:46:10 by karl]
improvements from eggert

Changes
diff --git a/ChangeLog b/ChangeLog
line changes: +8/-0
index 55a6664..5ffd140
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-11-09  Paul Eggert  <eggert@cs.ucla.edu>
+
+	* src/hello.c (main): Make greeting const char *, to avoid
+	a violation of the C standard when assigning _("...") to it.
+	Remove unnecessary #if ENABLE_NLS bracket.
+	If too many operands are given, report our name, and the first
+	extra one.
+
 2006-11-08  Karl Berry  <karl@gnu.org>
 
 	* pretest version 2.1.95.

diff --git a/src/hello.c b/src/hello.c
line changes: +3/-4
index 62f9ba9..baa7ee6
--- a/src/hello.c
+++ b/src/hello.c
@@ -42,18 +42,16 @@ main (int argc, char *argv[])
 {
   int optc;
   int t = 0, n = 0, lose = 0;
-  char *greeting = NULL;
+  const char *greeting = NULL;
 
   program_name = argv[0];
 
   /* Set locale via LC_ALL.  */
   setlocale (LC_ALL, "");
 
-#if ENABLE_NLS
   /* Set the text message domain.  */
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
-#endif
 
   while ((optc = getopt_long (argc, argv, "g:hntv", longopts, NULL)) != -1)
     switch (optc)
@@ -85,7 +83,8 @@ main (int argc, char *argv[])
     {
       /* Print error message and exit.  */
       if (optind < argc)
-        fputs (_("Too many arguments\n"), stderr);
+        fprintf (stderr, _("%s: extra operand: %s\n"),
+		 program_name, argv[optind]);
       fprintf (stderr, _("Try `%s --help' for more information.\n"),
                program_name);
       exit (1);

This website is licensed under AGPL-3.0. Feel free to copy!