m4-patches
[Top][All Lists]
Advanced

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

use progname module


From: Eric Blake
Subject: use progname module
Date: Tue, 03 Jun 2008 06:45:46 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080421 Thunderbird/2.0.0.14 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The master branch already uses the progname module; and based on coreutils
recent switch to use it, I decided that it is worth making branch-1.6 do
likewise.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhFPPoACgkQ84KuGfSFAYB8mgCgrt8x54j4wfw64LkrRX05L4jN
NcQAnRRDn1HAh6cJwfueweTXdi+vbKCl
=yZI8
-----END PGP SIGNATURE-----
>From 3be468475e78fc79f2e4aa60585daf7232e5c68d Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Tue, 3 Jun 2008 06:42:14 -0600
Subject: [PATCH] Use progname module rather than rolling our own program_name.

* m4/gnulib-cache.m4: Import progname module.
* src/m4.c (program_name): Replace...
(main): ...with a call to set_program_name.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog          |    7 +++++++
 m4/gnulib-cache.m4 |    4 ++--
 src/m4.c           |    6 ++----
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b3ddf60..adc0364 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-06-03  Eric Blake  <address@hidden>
+
+       Use progname module rather than rolling our own program_name.
+       * m4/gnulib-cache.m4: Import progname module.
+       * src/m4.c (program_name): Replace...
+       (main): ...with a call to set_program_name.
+
 2008-06-02  Eric Blake  <address@hidden>
 
        Stage 24: Allow embedded NUL in macro names.
diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4
index b6ba202..5aa4820 100644
--- a/m4/gnulib-cache.m4
+++ b/m4/gnulib-cache.m4
@@ -15,11 +15,11 @@
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --local-dir=local --lib=libm4 
--source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=build-aux --with-tests 
--no-libtool --macro-prefix=M4 announce-gen assert autobuild avltree-oset 
binary-io clean-temp cloexec close-stream closein config-h error fdl fflush 
flexmember fopen-safer fseeko gendocs getopt git-version-gen gnumakefile 
gnupload gpl-3.0 intprops memchr2 memmem mkstemp obstack quote regex stdbool 
stdint stdlib-safer strtod strtol unlocked-io vasnprintf-posix verror 
version-etc version-etc-fsf xalloc xmemdup0 xprintf xvasprintf-posix
+#   gnulib-tool --import --dir=. --local-dir=local --lib=libm4 
--source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=build-aux --with-tests 
--no-libtool --macro-prefix=M4 announce-gen assert autobuild avltree-oset 
binary-io clean-temp cloexec close-stream closein config-h error fdl fflush 
flexmember fopen-safer fseeko gendocs getopt git-version-gen gnumakefile 
gnupload gpl-3.0 intprops memchr2 memmem mkstemp obstack progname quote regex 
stdbool stdint stdlib-safer strtod strtol unlocked-io vasnprintf-posix verror 
version-etc version-etc-fsf xalloc xmemdup0 xprintf xvasprintf-posix
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([local])
-gl_MODULES([announce-gen assert autobuild avltree-oset binary-io clean-temp 
cloexec close-stream closein config-h error fdl fflush flexmember fopen-safer 
fseeko gendocs getopt git-version-gen gnumakefile gnupload gpl-3.0 intprops 
memchr2 memmem mkstemp obstack quote regex stdbool stdint stdlib-safer strtod 
strtol unlocked-io vasnprintf-posix verror version-etc version-etc-fsf xalloc 
xmemdup0 xprintf xvasprintf-posix])
+gl_MODULES([announce-gen assert autobuild avltree-oset binary-io clean-temp 
cloexec close-stream closein config-h error fdl fflush flexmember fopen-safer 
fseeko gendocs getopt git-version-gen gnumakefile gnupload gpl-3.0 intprops 
memchr2 memmem mkstemp obstack progname quote regex stdbool stdint stdlib-safer 
strtod strtol unlocked-io vasnprintf-posix verror version-etc version-etc-fsf 
xalloc xmemdup0 xprintf xvasprintf-posix])
 gl_AVOID([])
 gl_SOURCE_BASE([lib])
 gl_M4_BASE([m4])
diff --git a/src/m4.c b/src/m4.c
index e2ef4bc..238222f 100644
--- a/src/m4.c
+++ b/src/m4.c
@@ -25,6 +25,7 @@
 #include <signal.h>
 #include <stdarg.h>
 
+#include "progname.h"
 #include "version-etc.h"
 
 #define AUTHORS "Rene' Seindal", "Eric Blake"
@@ -66,9 +67,6 @@ int nesting_limit = 1024;
 const char *user_word_regexp = "";
 #endif
 
-/* The name this program was run with. */
-const char *program_name;
-
 /* Global catchall for any errors that should affect final error status, but
    where we try to continue execution in the meantime.  */
 int retcode;
@@ -413,7 +411,7 @@ main (int argc, char *const *argv, char *const *envp)
   const char *frozen_file_to_write = NULL;
   const char *macro_sequence = "";
 
-  program_name = argv[0];
+  set_program_name (argv[0]);
   retcode = EXIT_SUCCESS;
   atexit (close_stdin);
 
-- 
1.5.5.1


reply via email to

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