bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tim-4] Use basename (program_name) in messages


From: Tim Van Holder
Subject: [tim-4] Use basename (program_name) in messages
Date: Sun, 6 Jan 2002 18:51:31 +0100

I think this requires adding basename.c to lib/ for
systems that don't have it.
Alternatively, this could/should be conditionalized so
it's only used on DOSish systems, where argv0 always
contains the full path (whereas on Unices, it contains
what you typed to run the program).

2002-01-06  Tim Van Holder  <address@hidden>

        * src/getargs.c: Use basename() around program_name
        for cleaner messages.

Index: src/getargs.c
===================================================================
RCS file: /cvsroot/bison/bison/src/getargs.c,v
retrieving revision 1.32
diff -u -r1.32 getargs.c
--- src/getargs.c       29 Dec 2001 14:21:06 -0000      1.32
+++ src/getargs.c       6 Jan 2002 16:08:32 -0000
@@ -57,7 +57,7 @@
   putc ('\n', stream);
 
   fprintf (stream, _("\
-Usage: %s [OPTION]... FILE\n"), program_name);
+Usage: %s [OPTION]... FILE\n"), basename (program_name));
   putc ('\n', stream);
 
   fputs (_("\
@@ -213,7 +213,7 @@
 
       default:
        fprintf (stderr, _("Try `%s --help' for more information.\n"),
-                program_name);
+                basename (program_name));
        exit (1);
       }
 
@@ -221,12 +221,12 @@
 
   if (optind == argc)
     {
-      fprintf (stderr, _("%s: no grammar file given\n"), program_name);
+      fprintf (stderr, _("%s: no grammar file given\n"), basename
(program_name));
       exit (1);
     }
   if (optind < argc - 1)
     fprintf (stderr, _("%s: extra arguments ignored after `%s'\n"),
-            program_name, argv[optind]);
+            basename (program_name), argv[optind]);
 
   infile = argv[optind];
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]