]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
use gnulib's progname module
authorJim Meyering <meyering@redhat.com>
Tue, 3 Jun 2008 06:34:09 +0000 (08:34 +0200)
committerJim Meyering <meyering@redhat.com>
Tue, 3 Jun 2008 07:15:00 +0000 (09:15 +0200)
* bootstrap.conf (gnulib_modules): Add progname.
* src/*.c (program_name): Remove declaration.
* (main): Call set_program_name rather than setting program_name.
* src/nice.c (main): Cast program_name to "(char *)".
* src/prog-fprintf.c: Include "system.h"
* src/system.h: Include "progname.h".
* maint.mk (sc_program_name): Adjust rule.
Suggestion from Eric Blake.

98 files changed:
bootstrap.conf
maint.mk
src/base64.c
src/basename.c
src/cat.c
src/chcon.c
src/chgrp.c
src/chmod.c
src/chown.c
src/chroot.c
src/cksum.c
src/comm.c
src/copy.c
src/cp.c
src/csplit.c
src/cut.c
src/date.c
src/dd.c
src/df.c
src/dircolors.c
src/dirname.c
src/du.c
src/echo.c
src/env.c
src/expand.c
src/expr.c
src/factor.c
src/fmt.c
src/fold.c
src/groups.c
src/head.c
src/hostid.c
src/hostname.c
src/id.c
src/install.c
src/join.c
src/kill.c
src/link.c
src/ln.c
src/logname.c
src/ls.c
src/md5sum.c
src/mkdir.c
src/mkfifo.c
src/mknod.c
src/mktemp.c
src/mv.c
src/nice.c
src/nl.c
src/nohup.c
src/od.c
src/paste.c
src/pathchk.c
src/pinky.c
src/pr.c
src/printenv.c
src/printf.c
src/prog-fprintf.c
src/ptx.c
src/pwd.c
src/readlink.c
src/remove.c
src/rm.c
src/rmdir.c
src/runcon.c
src/seq.c
src/setuidgid.c
src/shred.c
src/shuf.c
src/sleep.c
src/sort.c
src/split.c
src/stat.c
src/stty.c
src/su.c
src/sum.c
src/sync.c
src/system.h
src/tac.c
src/tail.c
src/tee.c
src/test.c
src/timeout.c
src/touch.c
src/tr.c
src/true.c
src/tsort.c
src/tty.c
src/uname.c
src/unexpand.c
src/uniq.c
src/unlink.c
src/uptime.c
src/users.c
src/wc.c
src/who.c
src/whoami.c
src/yes.c

index 7b5be8386ca04a563e0df235d018810297197c3c..5685ad55b28fe3e7d37cb16d9b95d9cefdae034c 100644 (file)
@@ -70,6 +70,7 @@ gnulib_modules="
        posix-shell
        posixtm
        posixver
+       progname
        propername
        putenv
        quote quotearg raise readlink areadlink-with-size
index 25551a84ac3c58bd91ec91467a244c3afa9837cb..f4b0bae3288026429be3d4faa321c9a5a5239431 100644 (file)
--- a/maint.mk
+++ b/maint.mk
@@ -342,13 +342,13 @@ sc_system_h_headers: .re-list
        fi
 
 # Ensure that each .c file containing a "main" function also
-# declares "char *program_name", with or without "const".
+# calls set_program_name.
 sc_program_name:
        @if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then          \
          files=$$(grep -l '^main *(' $$($(VC_LIST_EXCEPT) | grep '\.c$$')); \
-         grep -EL '^(char const|(const )?char) \*program_name;' $$files \
+         grep -LE 'set_program_name *\(m?argv\[0\]\);' $$files         \
              | grep . &&                                               \
-         { echo '$(ME): the above files do not declare program_name'   \
+         { echo '$(ME): the above files do not call set_program_name'  \
                1>&2; exit 1; } || :;                                   \
        else :;                                                         \
        fi
index fd9d114dd36c8d308d9bc7d20e2bb2fbf8e35e52..3e66c12e012fa031508440878e8d5fac2144af6e 100644 (file)
@@ -37,9 +37,6 @@
 
 #define AUTHORS proper_name ("Simon Josefsson")
 
-/* The invocation name of this program.  */
-char const *program_name;
-
 static const struct option long_options[] = {
   {"decode", no_argument, 0, 'd'},
   {"wrap", required_argument, 0, 'w'},
@@ -248,7 +245,7 @@ main (int argc, char **argv)
   uintmax_t wrap_column = 76;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index fe056fcd6c61229a5dc4e2953b040574a9eeb1a9..38e887923f0cce600c2740864ddecc709b3a843a 100644 (file)
@@ -39,9 +39,6 @@
 
 #define AUTHORS proper_name ("FIXME unknown")
 
-/* The name this program was run with. */
-char const *program_name;
-
 void
 usage (int status)
 {
@@ -99,7 +96,7 @@ main (int argc, char **argv)
   char *name;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index fd6c9df0d053e6c3b50ca70651e2b6a8e35dc7d4..d762f454979161f791d193bd88ab19fae975798a 100644 (file)
--- a/src/cat.c
+++ b/src/cat.c
@@ -51,9 +51,6 @@
 #undef max
 #define max(h,i) ((h) > (i) ? (h) : (i))
 
-/* Name under which this program was invoked.  */
-char const *program_name;
-
 /* Name of input file.  May be "-".  */
 static char const *infile;
 
@@ -565,7 +562,7 @@ main (int argc, char **argv)
   };
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index dacce2b456c3fa7cb6a5f9c42c8e6159b6770d41..659664e3d6ff16a13f6e4ddd26f4fd9a9afca637 100644 (file)
@@ -55,9 +55,6 @@ enum Verbosity
   V_off
 };
 
-/* The name the program was run with. */
-char const *program_name;
-
 /* If nonzero, and the systems has support for it, change the context
    of symbolic links rather than any files they point to.  */
 static bool affect_symlink_referent;
@@ -426,7 +423,7 @@ main (int argc, char **argv)
   int optc;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index c42fad87f5028a8deb33be2f8d2780fe86a966f2..db83c59df8baa9095e4384011c8d6fa9b721006e 100644 (file)
@@ -42,9 +42,6 @@
 # define endgrent() ((void) 0)
 #endif
 
-/* The name the program was run with. */
-char const *program_name;
-
 /* The argument to the --reference option.  Use the group ID of this file.
    This file must exist.  */
 static char *reference_file;
@@ -184,7 +181,7 @@ main (int argc, char **argv)
   int optc;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 8002ef5f3c817ac39397ad5b8385de07ad14f2d5..80fc363aa30d464c52e7ad71d3e49b54ec5aaacb 100644 (file)
@@ -58,9 +58,6 @@ enum Verbosity
   V_off
 };
 
-/* The name the program was run with. */
-char const *program_name;
-
 /* The desired change to the mode.  */
 static struct mode_change *change;
 
@@ -394,7 +391,7 @@ main (int argc, char **argv)
   int c;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 02e0148f7fbb7650091b277729d2e4ce69ba021a..e5740d259be6c22fb44f3836db323ee9be9bdeb1 100644 (file)
@@ -47,9 +47,6 @@
   proper_name ("David MacKenzie"), \
   proper_name ("Jim Meyering")
 
-/* The name the program was run with. */
-char const *program_name;
-
 /* The argument to the --reference option.  Use the owner and group IDs
    of this file.  This file must exist.  */
 static char *reference_file;
@@ -186,7 +183,7 @@ main (int argc, char **argv)
   int optc;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 8081b1696b3078c79f75d092c97fae021701aa9a..399f76c30eec2a1b65134e932aae0863e0626ddc 100644 (file)
@@ -32,9 +32,6 @@
 
 #define AUTHORS proper_name ("Roland McGrath")
 
-/* The name this program was run with, for error messages. */
-char const *program_name;
-
 void
 usage (int status)
 {
@@ -66,7 +63,7 @@ int
 main (int argc, char **argv)
 {
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 6f1151484919bce1e90ef0079578f8ab465513f8..ce6e9c0565d456a90c4e293787e8aeca39830a57 100644 (file)
@@ -113,9 +113,6 @@ main (void)
 /* Number of bytes to read at once.  */
 # define BUFLEN (1 << 16)
 
-/* The name this program was run with.  */
-char const *program_name;
-
 static uint_fast32_t const crctab[256] =
 {
   0x00000000,
@@ -284,7 +281,7 @@ main (int argc, char **argv)
   bool ok;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 4700ca00e0708b71217da57933bdb2459a656f8a..a71d61afcfab68307b838a2b086feb4ea320bbc9 100644 (file)
@@ -39,9 +39,6 @@
 #undef min
 #define min(x, y) ((x) < (y) ? (x) : (y))
 
-/* The name this program was run with. */
-char const *program_name;
-
 /* True if the LC_COLLATE locale is hard.  */
 static bool hard_LC_COLLATE;
 
@@ -230,7 +227,7 @@ main (int argc, char **argv)
   int c;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 7d33cb33ab62417acaae49849f9c5ff027fdabac..82c6978e4ef67b8497c8ced2cbadbe524f06085f 100644 (file)
@@ -107,9 +107,6 @@ static bool owner_failure_ok (struct cp_options const *x);
 static char const *top_level_src_name;
 static char const *top_level_dst_name;
 
-/* The invocation name of this program.  */
-extern char *program_name;
-
 /* FIXME: describe */
 /* FIXME: rewrite this to use a hash table so we avoid the quadratic
    performance hit that's probably noticeable only on trees deeper
index 66304492abf293c56b5dbe3f5a2f770db2a2fdae..01b9c18d388cde9ba3761bae19e6cad22aee01c6 100644 (file)
--- a/src/cp.c
+++ b/src/cp.c
@@ -88,9 +88,6 @@ enum
 /* Initial number of entries in the inode hash table.  */
 #define INITIAL_ENTRY_TAB_SIZE 70
 
-/* The invocation name of this program.  */
-char const *program_name;
-
 /* True if the kernel is SELinux enabled.  */
 static bool selinux_enabled;
 
@@ -898,7 +895,7 @@ main (int argc, char **argv)
   bool no_target_directory = false;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 7d9904c3e439495ff3ad667bd1931656a1670641..7e63ca831e560d39e915eab9e1a8ce0bc5e55ef5 100644 (file)
@@ -128,9 +128,6 @@ static void delete_all_files (bool);
 static void save_line_to_file (const struct cstring *line);
 void usage (int status);
 
-/* The name this program was run with. */
-char const *program_name;
-
 /* Start of buffer list. */
 static struct buffer_record *head = NULL;
 
@@ -1330,7 +1327,7 @@ main (int argc, char **argv)
   unsigned long int val;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index a91cca71676316a4dd9b069e854d82945377bed0..0e151fd3e99b1b55e2bf5c430a38b0037af5bc8e 100644 (file)
--- a/src/cut.c
+++ b/src/cut.c
@@ -120,9 +120,6 @@ enum operating_mode
     field_mode
   };
 
-/* The name this program was run with. */
-char const *program_name;
-
 static enum operating_mode operating_mode;
 
 /* If true do not output lines containing no delimeter characters.
@@ -762,7 +759,7 @@ main (int argc, char **argv)
   char *spec_list_string IF_LINT(= NULL);
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 36b282695bca6f12aa2d157b57e556f3f767a3ab..86b322540e36bb047a87f519b104ddd6e3b3456b 100644 (file)
@@ -77,9 +77,6 @@ ARGMATCH_VERIFY (time_spec_string, time_spec);
 /* A format suitable for Internet RFC 2822.  */
 static char const rfc_2822_format[] = "%a, %d %b %Y %H:%M:%S %z";
 
-/* The name this program was run with, for error messages. */
-char const *program_name;
-
 /* For long options that have no equivalent short option, use a
    non-character as a pseudo short option, starting with CHAR_MAX + 1.  */
 enum
@@ -325,7 +322,7 @@ main (int argc, char **argv)
   int option_specified_date;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 947e6876c60a649ca47ff3c440d1dbe69982be7f..ead957464550416fe42debbc1a6580841a964b6d 100644 (file)
--- a/src/dd.c
+++ b/src/dd.c
@@ -128,9 +128,6 @@ enum
     STATUS_NOXFER = 01
   };
 
-/* The name this program was run with. */
-char const *program_name;
-
 /* The name of the input file, or NULL for the standard input. */
 static char const *input_file = NULL;
 
@@ -1671,7 +1668,7 @@ main (int argc, char **argv)
   off_t offset;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 2b320cf9892ba238bb615a86ae6b6a81cd3f17e9..66e920774ddcef81e642e06dacdf7acf24ee0ae7 100644 (file)
--- a/src/df.c
+++ b/src/df.c
@@ -42,9 +42,6 @@
   proper_name ("David MacKenzie"), \
   proper_name ("Paul Eggert")
 
-/* Name this program was run with. */
-char const *program_name;
-
 /* If true, show inode information. */
 static bool inode_format;
 
@@ -781,7 +778,7 @@ main (int argc, char **argv)
   struct stat *stats IF_LINT (= 0);
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 55cbd261615baeb4db7ab864e016ac8d867a4b89..44ec537fdce502eb8f8e09bff0f3bb2eb9f73d9e 100644 (file)
@@ -87,8 +87,6 @@ static struct option const long_options[] =
     {NULL, 0, NULL, 0}
   };
 
-char const *program_name;
-
 void
 usage (int status)
 {
@@ -402,7 +400,7 @@ main (int argc, char **argv)
   bool print_database = false;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 3c93d0357b535001f8d0eac9acfd4d5945625b98..3a319128f7983a2a07b66fd9c65992f797d3c4fd 100644 (file)
@@ -35,9 +35,6 @@
   proper_name ("David MacKenzie"), \
   proper_name ("Jim Meyering")
 
-/* The name this program was run with. */
-char const *program_name;
-
 void
 usage (int status)
 {
@@ -78,7 +75,7 @@ main (int argc, char **argv)
   size_t len;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 8b04b65d1c037d40acb3099cb4df19365d7310d8..32cb3631d32be015d81d2be06d942f44a5e08c2d 100644 (file)
--- a/src/du.c
+++ b/src/du.c
@@ -126,9 +126,6 @@ struct dulevel
   struct duinfo subdir;
 };
 
-/* Name under which this program was invoked.  */
-char const *program_name;
-
 /* If true, display counts for all files, not just directories.  */
 static bool opt_all = false;
 
@@ -685,7 +682,7 @@ main (int argc, char **argv)
   cwd_only[1] = NULL;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 4b8f56071ba2c4da5e75a1a1b184cbe046450e0b..ebbf5b82e0abcc63c9934ab295bc58f47d420be4 100644 (file)
@@ -50,9 +50,6 @@ on System V systems with the -E option.
 enum { DEFAULT_ECHO_TO_XPG = false };
 #endif
 
-/* The name this program was run with. */
-char const *program_name;
-
 void
 usage (int status)
 {
@@ -134,7 +131,7 @@ main (int argc, char **argv)
   bool do_v9 = DEFAULT_ECHO_TO_XPG;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 5103cc927ddf5e536256eb4c2cd5f2f90a2de428..67e411f18699debcb3c0371adf654c35732a0e85 100644 (file)
--- a/src/env.c
+++ b/src/env.c
@@ -96,9 +96,6 @@ int putenv ();
 
 extern char **environ;
 
-/* The name by which this program was run. */
-char const *program_name;
-
 static struct option const longopts[] =
 {
   {"ignore-environment", no_argument, NULL, 'i'},
@@ -143,7 +140,7 @@ main (int argc, char **argv)
   bool ignore_environment = false;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 2cce8fbea5effc24a759169dd61df4662537165a..8efb81b3355ae0a1981ca52242d1bc3155038765 100644 (file)
@@ -51,9 +51,6 @@
    allocated for the output line.  */
 #define OUTPUT_BLOCK 256
 
-/* The name this program was run with.  */
-char const *program_name;
-
 /* If true, convert blanks even after nonblank characters have been
    read on the line.  */
 static bool convert_entire_line;
@@ -370,7 +367,7 @@ main (int argc, char **argv)
   int c;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index e658402c51b1c6bd5021ffc4e28c25d4643b2b58..d6b19855b6867a663603881c6d7d8043c71c70ed 100644 (file)
@@ -81,9 +81,6 @@ typedef struct valinfo VALUE;
 /* The arguments given to the program, minus the program name.  */
 static char **args;
 
-/* The name this program was run with. */
-char const *program_name;
-
 static VALUE *eval (bool);
 static bool nomoreargs (void);
 static bool null (VALUE *v);
@@ -188,7 +185,7 @@ main (int argc, char **argv)
   VALUE *v;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 681db362d2b0b0969e545c6aa0e0458c2cdc9b9d..f46953c8b50efa3125cb7dc558784bd6cab48100 100644 (file)
@@ -59,9 +59,6 @@ static const unsigned char wheel_tab[] =
 #define WHEEL_START (wheel_tab + WHEEL_SIZE)
 #define WHEEL_END (wheel_tab + (sizeof wheel_tab / sizeof wheel_tab[0]))
 
-/* The name this program was run with. */
-char const *program_name;
-
 void
 usage (int status)
 {
@@ -192,7 +189,7 @@ main (int argc, char **argv)
   bool ok;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 1f4e1da523ff0dea5b786d0849d303d9d41377e7..708e60bca475444edd921f675396563fab9908f2 100644 (file)
--- a/src/fmt.c
+++ b/src/fmt.c
@@ -167,9 +167,6 @@ static void put_line (WORD *w, int indent);
 static void put_word (WORD *w);
 static void put_space (int space);
 
-/* The name this program was run with.  */
-char const *program_name;
-
 /* Option values.  */
 
 /* If true, first 2 lines may have different indent (default false).  */
@@ -324,7 +321,7 @@ main (int argc, char **argv)
   char const *max_width_option = NULL;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 8d63a8b52df9241522106753e2a271bc9bb491ca..57ff123c7231981f59fb747348ba5c686276746e 100644 (file)
@@ -34,9 +34,6 @@
 
 #define AUTHORS proper_name ("David MacKenzie")
 
-/* The name this program was run with. */
-char const *program_name;
-
 /* If nonzero, try to break on whitespace. */
 static bool break_spaces;
 
@@ -247,7 +244,7 @@ main (int argc, char **argv)
   bool ok;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index c67ac6e0ad4c9b69d9fee269845216e35dd202e2..ef9640005f93f1ec986b6cdd279149347241c1f4 100644 (file)
@@ -29,9 +29,6 @@
 #include "error.h"
 #include "group-list.h"
 
-/* The name this program was run with. */
-char const *program_name;
-
 /* The official name of this program (e.g., no `g' prefix).  */
 #define PROGRAM_NAME "groups"
 
@@ -76,7 +73,7 @@ main (int argc, char **argv)
   uid_t ruid;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index a52f151cf77b0de10c06af08fd05494712e5d1ce..7a0e2ada9d4d7e7db6612627dfc7dbff203d43da 100644 (file)
@@ -64,9 +64,6 @@ enum header_mode
   multiple_files, always, never
 };
 
-/* The name this program was run with. */
-char const *program_name;
-
 /* Have we ever read standard input?  */
 static bool have_read_stdin;
 
@@ -920,7 +917,7 @@ main (int argc, char **argv)
   char const *const *file_list;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index e481c1c1e6cfb1ad2de7f7cfd48da8a6f3c63fd7..dbcb98df8bb7788bafb040b46c9758cdfb1e6da5 100644 (file)
@@ -33,9 +33,6 @@
 
 #define AUTHORS proper_name ("Jim Meyering")
 
-/* The name this program was run with, for error messages. */
-char const *program_name;
-
 void
 usage (int status)
 {
@@ -64,7 +61,7 @@ main (int argc, char **argv)
   unsigned int id;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 23aab17b654da4b70876f3cf41e0b24cdd226ba1..cf8e9535b68e31fbeccc6fe67a516d10289a1b1f 100644 (file)
@@ -50,9 +50,6 @@ sethostname (char *name, size_t namelen)
 # define HAVE_SETHOSTNAME 1  /* Now we have it... */
 #endif
 
-/* The name this program was run with. */
-char const *program_name;
-
 void
 usage (int status)
 {
@@ -81,7 +78,7 @@ main (int argc, char **argv)
   char *hostname;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 53cb0f47f1136ed396ce4443c6aef99e9a143c34..14b558d65843897905b6f2cd0aa47c0c19480ebe 100644 (file)
--- a/src/id.c
+++ b/src/id.c
@@ -44,9 +44,6 @@ static int just_context = 0;
 static void print_user (uid_t uid);
 static void print_full_info (const char *username);
 
-/* The name this program was run with. */
-char const *program_name;
-
 /* If true, output user/group name instead of ID number. -n */
 static bool use_name = false;
 
@@ -121,7 +118,7 @@ main (int argc, char **argv)
   bool just_user = false;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index decdd7d36b29d3935d938afce168a540b1accd8b..aa14b948d2eb956e3b40a16dad384ee1bc03b8a8 100644 (file)
@@ -96,9 +96,6 @@ static int make_ancestor (char const *dir, char const *component,
                          void *options);
 void usage (int status);
 
-/* The name this program was run with, for error messages. */
-char const *program_name;
-
 /* The user name that will own the files, or NULL to make the owner
    the current user ID. */
 static char *owner_name;
@@ -338,7 +335,7 @@ main (int argc, char **argv)
   selinux_enabled = (0 < is_selinux_enabled ());
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 111f9714c76e74d37978d4763c6548c9d0e85d77..32872681caf143ffced38028bd06179add295822 100644 (file)
@@ -79,9 +79,6 @@ struct seq
     struct line *lines;
   };
 
-/* The name this program was run with.  */
-char const *program_name;
-
 /* The previous line read from each file. */
 static struct line *prevline[2];
 
@@ -934,7 +931,7 @@ main (int argc, char **argv)
   int i;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 21799076b6e365d22a7267191f6200a940497333..1fd495840473f34b56710fe6cf096a0152f9495e 100644 (file)
@@ -60,9 +60,6 @@
 # endif
 #endif
 \f
-/* The name this program was run with, for error messages.  */
-char const *program_name;
-
 static char const short_options[] =
   "0::1::2::3::4::5::6::7::8::9::"
   "A::B::C::D::E::F::G::H::I::J::K::L::M::"
@@ -241,7 +238,7 @@ main (int argc, char **argv)
   char signame[SIG2STR_MAX];
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index eeb79e7ff04ef651ca6e6afae0cf4b56188330ea..1b09fe32745ca6a303618d14c61435bda8be8d05 100644 (file)
@@ -35,9 +35,6 @@
 
 #define AUTHORS proper_name ("Michael Stone")
 
-/* Name this program was run with.  */
-char const *program_name;
-
 void
 usage (int status)
 {
@@ -63,7 +60,7 @@ int
 main (int argc, char **argv)
 {
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 4b9c9949a912e2c7bb5e8cfeb037386ef9d7dd30..137224073d8422cfbcc329c92ff3efbf2613e8ef 100644 (file)
--- a/src/ln.c
+++ b/src/ln.c
@@ -57,9 +57,6 @@
   lstat (File, Stat_buf)
 #endif
 
-/* The name by which the program was run, for error messages.  */
-char const *program_name;
-
 /* FIXME: document */
 static enum backup_type backup_type;
 
@@ -423,7 +420,7 @@ main (int argc, char **argv)
   char **file;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index ec894e216a37b5d256644e0ecbd34859ff2a9899..a71ac33a14f85e555c1e631b10ba63ab0a14f944 100644 (file)
@@ -29,9 +29,6 @@
 
 #define AUTHORS proper_name ("FIXME: unknown")
 
-/* The name this program was run with. */
-char const *program_name;
-
 void
 usage (int status)
 {
@@ -58,7 +55,7 @@ main (int argc, char **argv)
   char *cp;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 9a8ad2defd4fbd5f99132bd169e83b48217160f3..600d7a507d63fb411a58845620d6d9f68ca07055 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
@@ -244,9 +244,6 @@ static void sort_files (void);
 static void parse_ls_color (void);
 void usage (int status);
 
-/* The name this program was run with.  */
-char const *program_name;
-
 /* Initial size of hash table.
    Most hierarchies are likely to be shallower than this.  */
 #define INITIAL_TABLE_SIZE 30
@@ -1150,7 +1147,7 @@ main (int argc, char **argv)
 #endif
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 35849728020a23c3cc3f7a6428fd3518c636dcfb..dcafe97336a2352c7e58bc2d11849b8a8f962863 100644 (file)
@@ -120,9 +120,6 @@ static bool warn = false;
 /* With --check, suppress the "OK" printed for each verified file.  */
 static bool quiet = false;
 
-/* The name this program was run with.  */
-char const *program_name;
-
 /* For long options that have no equivalent short option, use a
    non-character as a pseudo short option, starting with CHAR_MAX + 1.  */
 enum
@@ -613,7 +610,7 @@ main (int argc, char **argv)
 
   /* Setting values of global variables.  */
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index c2d52deb566e90d2396dfab1bd5dd903847e6fac..9644f4c9fe9cc93f38e8e2492b607194995c71dc 100644 (file)
@@ -36,9 +36,6 @@
 
 #define AUTHORS proper_name ("David MacKenzie")
 
-/* The name this program was run with. */
-char const *program_name;
-
 static struct option const longopts[] =
 {
   {GETOPT_SELINUX_CONTEXT_OPTION_DECL},
@@ -153,7 +150,7 @@ main (int argc, char **argv)
   options.created_directory_format = NULL;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 5befd45900338c44daa4c1c20c3fc90716b9a417..d0d2c45197ddd2750c7c525bf6d1bc9f834accec 100644 (file)
@@ -32,9 +32,6 @@
 
 #define AUTHORS proper_name ("David MacKenzie")
 
-/* The name this program was run with. */
-char const *program_name;
-
 static struct option const longopts[] =
 {
   {GETOPT_SELINUX_CONTEXT_OPTION_DECL},
@@ -83,7 +80,7 @@ main (int argc, char **argv)
   security_context_t scontext = NULL;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 0cd2d2705b29afd75948b611e327a3719dcba0a3..d93e2cb9d3978fae48c17110c1f1a6d107126b9b 100644 (file)
@@ -33,9 +33,6 @@
 
 #define AUTHORS proper_name ("David MacKenzie")
 
-/* The name this program was run with. */
-char const *program_name;
-
 static struct option const longopts[] =
 {
   {GETOPT_SELINUX_CONTEXT_OPTION_DECL},
@@ -100,7 +97,7 @@ main (int argc, char **argv)
   security_context_t scontext = NULL;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 114fdc2b1cedaebc228d3f0580027992dfec513f..8a09231f985213321152cd5c1286d499432512b4 100644 (file)
@@ -35,9 +35,6 @@
 
 static const char *default_template = "tmp.XXXXXXXXXX";
 
-/* The name this program was run with. */
-char const *program_name;
-
 /* For long options that have no equivalent short option, use a
    non-character as a pseudo short option, starting with CHAR_MAX + 1.  */
 enum
@@ -144,7 +141,7 @@ main (int argc, char **argv)
   char *dest_name;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 090541a4c267c313f7cf6816e626b22310131813..bab26ba46c006c8f3ab5c55ae231ed1852e261e5 100644 (file)
--- a/src/mv.c
+++ b/src/mv.c
@@ -56,9 +56,6 @@ enum
   STRIP_TRAILING_SLASHES_OPTION
 };
 
-/* The name this program was run with. */
-char const *program_name;
-
 /* Remove any trailing slashes from each SOURCE argument.  */
 static bool remove_trailing_slashes;
 
@@ -364,7 +361,7 @@ main (int argc, char **argv)
   char **file;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 3981a716381d56d4a9444d2a58a27e983391a25e..1dcb3a3cbce02cb97af392e895c30eda904020e7 100644 (file)
@@ -55,9 +55,6 @@
 # define NZERO 20
 #endif
 
-/* The name this program was run with. */
-char const *program_name;
-
 static struct option const longopts[] =
 {
   {"adjustment", required_argument, NULL, 'n'},
@@ -99,7 +96,7 @@ main (int argc, char **argv)
   int i;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
@@ -126,7 +123,7 @@ main (int argc, char **argv)
          char **fake_argv = argv + (i - 1);
 
          /* Ensure that any getopt diagnostics use the right name.  */
-         fake_argv[0] = program_name;
+         fake_argv[0] = (char *) program_name;
 
          /* Initialize getopt_long's internal state.  */
          optind = 0;
index 24e9f9861ccf30aa4e95b0422a86c01b107c2994..ddd0fcfded5e180339069b888a15949a42ca7307 100644 (file)
--- a/src/nl.c
+++ b/src/nl.c
@@ -61,9 +61,6 @@ enum section
   Header, Body, Footer, Text
 };
 
-/* The name this program was run with. */
-char const *program_name;
-
 /* Format of body lines (-b).  */
 static char const *body_type = "t";
 
@@ -460,7 +457,7 @@ main (int argc, char **argv)
   bool ok = true;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index da639f225c7d25e67ca8ce1edadee3a4a25a965a..61f181dbd0f8d35ce1ed62cf1ceeda15b4f2f656 100644 (file)
@@ -43,8 +43,6 @@ enum
     NOHUP_FAILURE = 127
   };
 
-char const *program_name;
-
 void
 usage (int status)
 {
@@ -89,7 +87,7 @@ main (int argc, char **argv)
   bool redirecting_stderr;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 9b2f722608a7ee5a7c2083999eb411cbd8f8e0eb..3273ec2eedef6e0d6f7ec2a6bcc3c9dc95277d7a 100644 (file)
--- a/src/od.c
+++ b/src/od.c
@@ -113,9 +113,6 @@ struct tspec
     int field_width;
   };
 
-/* The name this program was run with.  */
-char const *program_name;
-
 /* Convert the number of 8-bit bytes of a binary representation to
    the number of characters (digits + sign if the type is signed)
    required to represent the same quantity in the specified base/type.
@@ -1565,7 +1562,7 @@ main (int argc, char **argv)
   uintmax_t pseudo_start IF_LINT (= 0);
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index cc61a09d53d8a5449bf76880bd5ab743170081fd..9dee94aa459559b42ad551aa617d553780d3024d 100644 (file)
@@ -54,9 +54,6 @@
 /* Indicates that no delimiter should be added in the current position. */
 #define EMPTY_DELIM '\0'
 
-/* Name this program was run with. */
-char const *program_name;
-
 /* If nonzero, we have read standard input at some point. */
 static bool have_read_stdin;
 
@@ -466,7 +463,7 @@ main (int argc, char **argv)
   char const *delim_arg = "\t";
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 821fe335b185150eb2128e8f02eaed2fa5fc204a..48001fc03d73f9a03e3ba1d43f42456759fd5eaf 100644 (file)
@@ -71,9 +71,6 @@
 
 static bool validate_file_name (char *, bool, bool);
 
-/* The name this program was run with. */
-char const *program_name;
-
 /* For long options that have no equivalent short option, use a
    non-character as a pseudo short option, starting with CHAR_MAX + 1.  */
 enum
@@ -121,7 +118,7 @@ main (int argc, char **argv)
   int optc;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index b8d453b14f72364bfd224ea8ca62c3a6dc06ae15..9c80d94d536300176a1632c45d4cade9f7c8113a 100644 (file)
@@ -44,9 +44,6 @@
 
 char *ttyname ();
 
-/* The name this program was run with. */
-char const *program_name;
-
 /* If true, display the hours:minutes since each user has touched
    the keyboard, or blank if within the last minute, or days followed
    by a 'd' if not within the last day. */
@@ -544,7 +541,7 @@ main (int argc, char **argv)
   int n_users;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 28ce71370826dde52f390d8114245f091066f20b..27ff8593f1efa758ebfa762f0c5fa89add5283d8 100644 (file)
--- a/src/pr.c
+++ b/src/pr.c
@@ -445,9 +445,6 @@ static void cleanup (void);
 static void print_sep_string (void);
 static void separator_string (const char *optarg_S);
 
-/* The name under which this program was invoked. */
-char const *program_name;
-
 /* All of the columns to print.  */
 static COLUMN *column_vector;
 
@@ -869,7 +866,7 @@ main (int argc, char **argv)
   size_t n_alloc = 0;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index b90551cf966a3897a7aebc5668e988b8caba76fa..b68fb219bd8a0934b200d9648b9a2d44616c2ca0 100644 (file)
@@ -45,9 +45,6 @@ enum { PRINTENV_FAILURE = 2 };
   proper_name ("David MacKenzie"), \
   proper_name ("Richard Mlynarik")
 
-/* The name this program was run with. */
-char const *program_name;
-
 extern char **environ;
 
 void
@@ -82,7 +79,7 @@ main (int argc, char **argv)
   bool ok;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 7081dccd9d96b0b036b2929433719f73f3940983..a9d5aa144889834ef2dc72f707d154f263471280 100644 (file)
@@ -78,9 +78,6 @@ static bool posixly_correct;
 static char const *const cfcc_msg =
  N_("warning: %s: character(s) following character constant have been ignored");
 
-/* The name this program was run with. */
-char const *program_name;
-
 void
 usage (int status)
 {
@@ -637,7 +634,7 @@ main (int argc, char **argv)
   int args_used;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 85aceb61f55fe5266e14b736a281b689c6024499..cbf7becc6114a2162626b83cd47d3b80d0a706ed 100644 (file)
@@ -18,9 +18,9 @@
 #include <stdarg.h>
 #include <sys/types.h>
 
-#include "prog-fprintf.h"
+#include "system.h"
 
-extern char *program_name;
+#include "prog-fprintf.h"
 
 /* Display program name followed by variable list.
    Used for e.g. verbose output */
index cdc65137e5ad2bdf6577df6cf041ebafb5bc4ea0..28dfc875311af3f772e1a3f63360792a0d3bd0d8 100644 (file)
--- a/src/ptx.c
+++ b/src/ptx.c
@@ -68,9 +68,6 @@
 /* Imported from "regex.c".  */
 #define Sword 1
 
-/* The name this program was run with. */
-char const *program_name;
-
 /* Program options.  */
 
 enum Format
@@ -1980,7 +1977,7 @@ main (int argc, char **argv)
   /* Decode program options.  */
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index adbc5b33dcb315aaeb813368d00c365ae7a03f3e..5038065d338252bb2b155981cb94c09cc62909aa 100644 (file)
--- a/src/pwd.c
+++ b/src/pwd.c
@@ -39,9 +39,6 @@ struct file_name
   char *start;
 };
 
-/* The name this program was run with. */
-char const *program_name;
-
 void
 usage (int status)
 {
@@ -289,7 +286,7 @@ main (int argc, char **argv)
   char *wd;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 455b56e85289f8cd6d14e52183cb948045372aa8..98a955c0ca4ad1cf0596aaeda95347c1138c3e11 100644 (file)
@@ -32,9 +32,6 @@
 
 #define AUTHORS proper_name ("Dmitry V. Levin")
 
-/* Name this program was run with.  */
-char const *program_name;
-
 /* If true, do not output the trailing newline.  */
 static bool no_newline;
 
@@ -105,7 +102,7 @@ main (int argc, char **argv)
   int optc;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 07c2f71ba596efbab1ae20150f9d2c02df3259ef..4c3ee99eafce12ce8605581292f2467833bead7c 100644 (file)
@@ -128,8 +128,6 @@ struct AD_ent
 # define DT_LNK 2
 #endif
 
-extern char *program_name;
-
 struct dirstack_state
 {
   /* The name of the directory (starting with and relative to a command
index eb90bf2cd49b21ab779d2a11352cbd095b85223f..7304330c87f07145d89898d671d2149f7b31327c 100644 (file)
--- a/src/rm.c
+++ b/src/rm.c
@@ -66,9 +66,6 @@
   proper_name ("Richard M. Stallman"), \
   proper_name ("Jim Meyering")
 
-/* Name this program was run with.  */
-char const *program_name;
-
 /* For long options that have no equivalent short option, use a
    non-character as a pseudo short option, starting with CHAR_MAX + 1.  */
 enum
@@ -236,7 +233,7 @@ main (int argc, char **argv)
   int c;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 4ed2f7742683fe3fc300de90b86b5ad2d43da178..64575b091889cf48fd317361ed1bd0d1f7767a45 100644 (file)
@@ -38,9 +38,6 @@
 
 #define AUTHORS proper_name ("David MacKenzie")
 
-/* The name this program was run with. */
-char const *program_name;
-
 /* If true, remove empty parent directories.  */
 static bool remove_empty_parents;
 
@@ -193,7 +190,7 @@ main (int argc, char **argv)
   int optc;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 5f9746cf09ace244745d3e73ddb4f40d301b7160..a5c2300fca3a1dda14197b96bfdfa2e9615ce3d2 100644 (file)
@@ -72,9 +72,6 @@ static struct option long_options[] = {
   {NULL, 0, NULL, 0}
 };
 
-/* The name the program was run with. */
-char const *program_name;
-
 void
 usage (int status)
 {
@@ -122,7 +119,7 @@ main (int argc, char **argv)
   context_t con;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 2fe6ec2674e5c9604744281e99d8acaca05516e2..55518dfaba1d2561cbd4d0f8786294bfdab51c1e 100644 (file)
--- a/src/seq.c
+++ b/src/seq.c
@@ -43,9 +43,6 @@
 /* If true print all number with equal width.  */
 static bool equal_width;
 
-/* The name that this program was run with.  */
-char const *program_name;
-
 /* The string used to separate two numbers.  */
 static char const *separator;
 
@@ -380,7 +377,7 @@ main (int argc, char **argv)
   char const *format_str = NULL;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index a6262fe4edd8c0733117c581f0642c388c7459e3..e9103572dd57e4e3c4c0f1909f1728d55d5f8ece 100644 (file)
@@ -39,8 +39,6 @@
 
 #define SETUIDGID_FAILURE 111
 
-char const *program_name;
-
 void
 usage (int status)
 {
@@ -84,7 +82,7 @@ main (int argc, char **argv)
   gid_t primary_gid;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 1b941810c0a05c16a6311d4407a0edae7ccf638e..bfafa96f395e38781bc93820469382b9de92a9e4 100644 (file)
@@ -148,9 +148,6 @@ static struct option const long_opts[] =
   {NULL, 0, NULL, 0}
 };
 
-/* Global variable for error printing purposes */
-char const *program_name; /* Initialized before any possible use */
-
 void
 usage (int status)
 {
@@ -1100,7 +1097,7 @@ main (int argc, char **argv)
   char const *random_source = NULL;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 359aeb0c89963b3485fc39b30ae8522cb3ccb7b1..ca5345b4bfe241e1d0777bbd044d24785c850e8a 100644 (file)
@@ -36,9 +36,6 @@
 
 #define AUTHORS proper_name ("Paul Eggert")
 
-/* The name this program was run with. */
-char const *program_name;
-
 void
 usage (int status)
 {
@@ -261,7 +258,7 @@ main (int argc, char **argv)
   size_t *permutation;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 5ae704517a9f9f3ce570570d2c5f106125288bfd..4176977f03b8d4bf5d0315d8a2622c5992504497 100644 (file)
@@ -35,9 +35,6 @@
   proper_name ("Jim Meyering"), \
   proper_name ("Paul Eggert")
 
-/* The name by which this program was run. */
-char const *program_name;
-
 void
 usage (int status)
 {
@@ -107,7 +104,7 @@ main (int argc, char **argv)
   bool ok = true;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 5b272e7b7c94e7d3876a3d55f95ec22837652b0b..632c5c8363618b055a21f3d6fca4b8b3422da23e 100644 (file)
@@ -183,9 +183,6 @@ struct month
   int val;
 };
 
-/* The name this program was run with. */
-char const *program_name;
-
 /* FIXME: None of these tables work with multibyte character sets.
    Also, there are many other bugs when handling multibyte characters.
    One way to fix this is to rewrite `sort' to use wide characters
@@ -2757,7 +2754,7 @@ main (int argc, char **argv)
   char const *outfile = NULL;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 4937e55a818307402f6302266799e406c0c7e623..71200fb320f639f7213eacbbe9ea1c79520f2135 100644 (file)
@@ -46,9 +46,6 @@
 
 #define DEFAULT_SUFFIX_LENGTH 2
 
-/* The name this program was run with. */
-char const *program_name;
-
 /* Base name of output files.  */
 static char const *outbase;
 
@@ -395,7 +392,7 @@ main (int argc, char **argv)
   int digits_optind = 0;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 7b750a085a62cba027a0c8350cd8b4d47b480795..0d52c27b1ec45aaae19e9f7fbc225d5a12da8600 100644 (file)
@@ -173,8 +173,6 @@ static struct option const long_options[] = {
   {NULL, 0, NULL, 0}
 };
 
-char const *program_name;
-
 /* Whether to follow symbolic links;  True for --dereference (-L).  */
 static bool follow_links;
 
@@ -1005,7 +1003,7 @@ main (int argc, char *argv[])
   bool ok = true;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 3441365744199c2c89b646a246c704ff93a01310..004c3186c25af1371857261bc1290f3b8fed15d8 100644 (file)
@@ -455,9 +455,6 @@ static struct option longopts[] =
   {NULL, 0, NULL, 0}
 };
 
-/* The name this program was run with. */
-char const *program_name;
-
 static void wrapf (const char *message, ...)
      __attribute__ ((__format__ (__printf__, 1, 2)));
 
@@ -745,7 +742,7 @@ main (int argc, char **argv)
   const char *device_name;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index d6aaaaa8869c2ea5bb4310fdd6b0b74635223a5a..f6b61f773557e45c97444025225e64c15377a586 100644 (file)
--- a/src/su.c
+++ b/src/su.c
@@ -128,9 +128,6 @@ extern char **environ;
 static void run_shell (char const *, char const *, char **, size_t)
      ATTRIBUTE_NORETURN;
 
-/* The name this program was run with.  */
-char const *program_name;
-
 /* If true, pass the `-f' option to the subshell.  */
 static bool fast_startup;
 
@@ -414,7 +411,7 @@ main (int argc, char **argv)
   struct passwd pw_copy;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index a2aa94570df7acf5078d234628b650c0076ad08a..4dfc86797ae0a6094fb14a92ab9c51122dd2cb70 100644 (file)
--- a/src/sum.c
+++ b/src/sum.c
@@ -36,9 +36,6 @@
   proper_name ("Kayvan Aghaiepour"), \
   proper_name ("David MacKenzie")
 
-/* The name this program was run with. */
-char const *program_name;
-
 /* True if any of the files read were the standard input. */
 static bool have_read_stdin;
 
@@ -228,7 +225,7 @@ main (int argc, char **argv)
   bool (*sum_func) (const char *, int) = bsd_sum_file;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index fe09c01ce6238f546e9b86bfd13fa8896c407a8c..96dcf0953673755775e0c0dfc4b8e7aa56a5f998 100644 (file)
@@ -30,9 +30,6 @@
 
 #define AUTHORS proper_name ("Jim Meyering")
 
-/* The name this program was run with. */
-char const *program_name;
-
 void
 usage (int status)
 {
@@ -57,7 +54,7 @@ int
 main (int argc, char **argv)
 {
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index f7c689f8e4e0a14264a96ab473457cfde946f408..c69ddca34ec281fbdd5556c8600b90d24db5c650 100644 (file)
@@ -462,6 +462,8 @@ enum
    of the 100 binaries. */
 #define proper_name(x) (x)
 
+#include "progname.h"
+
 #define case_GETOPT_VERSION_CHAR(Program_name, Authors)                        \
   case GETOPT_VERSION_CHAR:                                            \
     version_etc (stdout, Program_name, PACKAGE_NAME, VERSION, Authors, \
index baaf5ed16b72ea79dec14e91877afaaf0b88bec8..9cf6d60dc218237fefed187fead0b21169c3b712 100644 (file)
--- a/src/tac.c
+++ b/src/tac.c
@@ -75,9 +75,6 @@ tac -r -s '.\|
 /* The number of bytes per atomic write. */
 #define WRITESIZE 8192
 
-/* The name this program was run with. */
-char const *program_name;
-
 /* The string that separates the records of the file. */
 static char const *separator;
 
@@ -575,7 +572,7 @@ main (int argc, char **argv)
   char const *const *file;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index f6ade24b240368300645225d595b29ea4ad39b2c..1ce207e524ee64c66fff00de04b546050e424f26 100644 (file)
@@ -162,9 +162,6 @@ enum header_mode
 static uintmax_t max_n_unchanged_stats_between_opens =
   DEFAULT_MAX_N_UNCHANGED_STATS_BETWEEN_OPENS;
 
-/* The name this program was run with.  */
-char const *program_name;
-
 /* The process ID of the process (presumably on the current host)
    that is writing to all followed files.  */
 static pid_t pid;
@@ -1599,7 +1596,7 @@ main (int argc, char **argv)
   double sleep_interval = 1.0;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 2f1c7bb55ff93ebd4fc151e402eb14c8c457c617..162455c536442afe067ced1870b3da8077fc2d97 100644 (file)
--- a/src/tee.c
+++ b/src/tee.c
@@ -41,9 +41,6 @@ static bool append;
 /* If true, ignore interrupts. */
 static bool ignore_interrupts;
 
-/* The name that this program was run with. */
-char const *program_name;
-
 static struct option const long_options[] =
 {
   {"append", no_argument, NULL, 'a'},
@@ -86,7 +83,7 @@ main (int argc, char **argv)
   int optc;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 88579d2ca70ac43798e16debc653faf620f3d606..858a837e5833580784a63ecf8eff2af55d61aa42 100644 (file)
@@ -48,8 +48,6 @@
 # include <sys/param.h>
 #endif
 
-char const *program_name;
-
 /* Exit status for syntax errors, etc.  */
 enum { TEST_TRUE, TEST_FALSE, TEST_FAILURE };
 
@@ -809,7 +807,7 @@ main (int margc, char **margv)
     return (test_error_return);
 #else /* TEST_STANDALONE */
   initialize_main (&margc, &margv);
-  program_name = margv[0];
+  set_program_name (margv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 9373cfa36fcb28b1f41ba01fcf1394f5f7344d94..f7f9af01216c81a6aaa9fbc585136c0163e0d2bb 100644 (file)
@@ -83,8 +83,6 @@ static int term_signal = SIGTERM;  /* same default as kill command.  */
 static int monitored_pid;
 static int sigs_to_ignore[NSIG];   /* so monitor can ignore sigs it resends.  */
 
-char const *program_name;
-
 static struct option const long_options[] = {
   {"signal", required_argument, NULL, 's'},
   {NULL, 0, NULL, 0}
@@ -224,7 +222,7 @@ main (int argc, char **argv)
   char *ep;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index b8e4f2e1c4b9575623445e4682555e95eea71c5a..bbc9c60129dc46b5e275ad5acaf3d1c6d3235228 100644 (file)
@@ -48,9 +48,6 @@
 #define CH_ATIME 1
 #define CH_MTIME 2
 
-/* The name by which this program was run. */
-char const *program_name;
-
 /* Which timestamps to change. */
 static int change_times;
 
@@ -280,7 +277,7 @@ main (int argc, char **argv)
   char const *flex_date = NULL;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 532e4f01ac47a53b92780cdb82e7abc7e700f0eb..e1bb4049966370df2c4adf24a5129a65f07ea1ec 100644 (file)
--- a/src/tr.c
+++ b/src/tr.c
@@ -193,9 +193,6 @@ es_match (struct E_string const *es, size_t i, char c)
   return es->s[i] == c && !es->escaped[i];
 }
 
-/* The name by which this program was run.  */
-char const *program_name;
-
 /* When true, each sequence in the input of a repeated character
    (call it c) is replaced (in the output) by a single occurrence of c
    for every c in the squeeze set.  */
@@ -1671,7 +1668,7 @@ main (int argc, char **argv)
   struct Spec_list *s2 = &buf2;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index ae6990a3f463881d61de70a736e8072825ef034e..75e53bcf5d39f5d061822fb6231b433b114ec5af 100644 (file)
@@ -32,9 +32,6 @@
 
 #define AUTHORS proper_name ("Jim Meyering")
 
-/* The name this program was run with. */
-char const *program_name;
-
 void
 usage (int status)
 {
@@ -58,7 +55,7 @@ int
 main (int argc, char **argv)
 {
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index a68ba04dce0a395b95245e8b6da716875b06ec17..703b8557db5e107b2c81e92ef43c3a1e42170d2b 100644 (file)
@@ -59,9 +59,6 @@ struct item
   struct successor *top;
 };
 
-/* The name this program was run with. */
-char const *program_name;
-
 /* The head of the sorted list.  */
 static struct item *head = NULL;
 
@@ -534,7 +531,7 @@ main (int argc, char **argv)
   bool ok;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index fe19b0110f1af1f669536c2d9b2928c995313c55..c7b13dcabb6f638ec204c9b1d84d49a856bbe7e8 100644 (file)
--- a/src/tty.c
+++ b/src/tty.c
@@ -42,9 +42,6 @@ enum
 
 #define AUTHORS proper_name ("David MacKenzie")
 
-/* The name under which this program was run. */
-char const *program_name;
-
 /* If true, return an exit status but produce no output. */
 static bool silent;
 
@@ -85,7 +82,7 @@ main (int argc, char **argv)
   int optc;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 4691afc5cbae2a8a8ef9241d22b4e4562a0d5bf3..3870dfa3d07f3c79cc9a7af8b86249da5de0add8 100644 (file)
@@ -86,9 +86,6 @@
 /* Operating system.  */
 #define PRINT_OPERATING_SYSTEM 128
 
-/* The name this program was run with, for error messages. */
-char const *program_name;
-
 static struct option const uname_long_options[] =
 {
   {"all", no_argument, NULL, 'a'},
@@ -269,7 +266,7 @@ main (int argc, char **argv)
   unsigned int toprint = 0;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 1fc65d39e58ea3e310dfb8d5db617008d0b63043..5a2d0cdeb787d64521bc12502337b818ecf333a6 100644 (file)
@@ -52,9 +52,6 @@
    allocated for the output line.  */
 #define OUTPUT_BLOCK 256
 
-/* The name this program was run with.  */
-char const *program_name;
-
 /* If true, convert blanks even after nonblank characters have been
    read on the line.  */
 static bool convert_entire_line;
@@ -464,7 +461,7 @@ main (int argc, char **argv)
   bool convert_first_only = false;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index f8948e26ab10454ef440731f8471d564c68392fb..5af52710c6f1a714eb5e4d5a6d1b86cce4a8857b 100644 (file)
@@ -50,9 +50,6 @@
     }                                          \
   while (0)
 
-/* The name this program was run with. */
-char const *program_name;
-
 /* True if the LC_COLLATE locale is hard.  */
 static bool hard_LC_COLLATE;
 
@@ -418,7 +415,7 @@ main (int argc, char **argv)
 
   file[0] = file[1] = "-";
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 0ef24480eccb3df5e3882bea31a86d22c11aba68..36595c8dcffe01454e4f1ddcadcf9ce53054682a 100644 (file)
@@ -35,9 +35,6 @@
 
 #define AUTHORS proper_name ("Michael Stone")
 
-/* Name this program was run with.  */
-char const *program_name;
-
 void
 usage (int status)
 {
@@ -62,7 +59,7 @@ int
 main (int argc, char **argv)
 {
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 1179ce56886432a8faf88dbfa8b7dcbc43a433ea..9e3384fc8aca4a4088e68a30119a22afdfe86c64 100644 (file)
@@ -47,9 +47,6 @@
 
 int getloadavg ();
 
-/* The name this program was run with. */
-char const *program_name;
-
 static void
 print_uptime (size_t n, const STRUCT_UTMP *this)
 {
@@ -216,7 +213,7 @@ int
 main (int argc, char **argv)
 {
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index b1e8b3d8b0b1a835cc30b45c293458e9dcabdd75..551616e84ff0d9d9bdea6bf95a18d13510a6124c 100644 (file)
@@ -35,9 +35,6 @@
   proper_name ("Joseph Arceneaux"), \
   proper_name ("David MacKenzie")
 
-/* The name this program was run with. */
-char const *program_name;
-
 static int
 userid_compare (const void *v_a, const void *v_b)
 {
@@ -124,7 +121,7 @@ int
 main (int argc, char **argv)
 {
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 731eb4a47aea934f2a21bd3af1ac68ec4da0cb2c..8073bb0f97278de9859b8e28110de9c886fd92eb 100644 (file)
--- a/src/wc.c
+++ b/src/wc.c
@@ -49,9 +49,6 @@
 /* Size of atomic reads. */
 #define BUFFER_SIZE (16 * 1024)
 
-/* The name this program was run with. */
-char const *program_name;
-
 /* Cumulative number of lines, words, chars and bytes in all files so far.
    max_line_length is the maximum over all files processed so far.  */
 static uintmax_t total_lines;
@@ -589,7 +586,7 @@ main (int argc, char **argv)
   struct Tokens tok;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index bec924fb212e037538a69b69151348a5876c7d98..34b56481de0b5d321c77223a7833f643e980e91e 100644 (file)
--- a/src/who.c
+++ b/src/who.c
@@ -98,9 +98,6 @@
 
 char *ttyname ();
 
-/* The name this program was run with. */
-char const *program_name;
-
 /* If true, attempt to canonicalize hostnames via a DNS lookup. */
 static bool do_lookup;
 
@@ -677,7 +674,7 @@ main (int argc, char **argv)
   bool assumptions = true;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 7686fd0839ead2aba180c72d184fba5ff4fb8b02..c3b709bc48e80d8cb078eb2462e55efce0ee0f4f 100644 (file)
@@ -35,9 +35,6 @@
 
 #define AUTHORS proper_name ("Richard Mlynarik")
 
-/* The name this program was run with. */
-char const *program_name;
-
 void
 usage (int status)
 {
@@ -66,7 +63,7 @@ main (int argc, char **argv)
   uid_t uid;
 
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
index 7dec1ecdd9de058eb6bbb7b40505bfdd62d00b44..d72c5da87ec17e18611469776daa8fabd0e72a5d 100644 (file)
--- a/src/yes.c
+++ b/src/yes.c
@@ -31,9 +31,6 @@
 
 #define AUTHORS proper_name ("David MacKenzie")
 
-/* The name this program was run with. */
-char const *program_name;
-
 void
 usage (int status)
 {
@@ -63,7 +60,7 @@ int
 main (int argc, char **argv)
 {
   initialize_main (&argc, &argv);
-  program_name = argv[0];
+  set_program_name (argv[0]);
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);