From: Bruno Haible Date: Tue, 15 May 2001 19:59:42 +0000 (+0000) Subject: Remove "lt-" prefix from program name. X-Git-Tag: v0.11~723 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07b81ac15950d0f795e459dd7bca29d2510ba200;p=thirdparty%2Fgettext.git Remove "lt-" prefix from program name. --- diff --git a/lib/ChangeLog b/lib/ChangeLog index 3c966c738..d592daeec 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,9 @@ +2001-05-15 Bruno Haible + + * progname.h (set_program_name): New declaration. + * progname.c: Include . + (set_program_name): New function. + 2001-05-02 Bruno Haible * xerror.h: New file. diff --git a/lib/progname.c b/lib/progname.c index 7068b395b..7bf9ff466 100644 --- a/lib/progname.c +++ b/lib/progname.c @@ -22,6 +22,7 @@ #endif #include +#include #include "progname.h" @@ -30,6 +31,18 @@ To be initialized by main(). */ const char *program_name; +/* Set program_name, based on argv[0]. */ +void +set_program_name (argv0) + const char *argv0; +{ + /* libtool creates a temporary executable whose name is prefixed with + "lt-". Remove this prefix here. */ + if (strncmp (argv0, "lt-", 3) == 0) + argv0 += 3; + program_name = argv0; +} + /* Indicates whether errors and warnings get prefixed with program_name. Default is true. */ int error_with_progname = 1; diff --git a/lib/progname.h b/lib/progname.h index 7ddd3063b..aaddd88fa 100644 --- a/lib/progname.h +++ b/lib/progname.h @@ -23,13 +23,16 @@ with the program name. Programs using this file should do the following in main(): - program_name = argv[0]; + set_program_name (argv[0]); error_print_progname = maybe_print_progname; */ /* String containing name the program is called with. */ extern const char *program_name; +/* Set program_name, based on argv[0]. */ +extern void set_program_name PARAMS ((const char *argv0)); + /* Indicates whether errors and warnings get prefixed with program_name. Default is true. A reason to omit the prefix is for better interoperability with Emacs' diff --git a/src/ChangeLog b/src/ChangeLog index fa5af4281..1104482f3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,15 @@ +2001-05-15 Bruno Haible + + * msgcmp.c (main): Call set_program_name instead of assigning + program_name directly. + * msgcomm.c (main): Likewise. + * msgfmt.c (main): Likewise. + * msgmerge.c (main): Likewise. + * msgunfmt.c (main): Likewise. + * xgettext.c (main): Likewise. + * gettext.c (main): Remove "lt-" prefix from program_name. + * ngettext.c (main): Likewise. + 2001-05-04 Bruno Haible * gettext.c (usage): Add description of what the program does. diff --git a/src/gettext.c b/src/gettext.c index 7bb4330e3..9a8cbb2d8 100644 --- a/src/gettext.c +++ b/src/gettext.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "error.h" @@ -90,6 +91,8 @@ main (argc, argv) /* Set program name for message texts. */ program_name = argv[0]; + if (strncmp (program_name, "lt-", 3) == 0) + program_name += 3; #ifdef HAVE_SETLOCALE /* Set locale via LC_ALL. */ diff --git a/src/msgcmp.c b/src/msgcmp.c index 7bff9caef..7c9f029c1 100644 --- a/src/msgcmp.c +++ b/src/msgcmp.c @@ -92,7 +92,7 @@ main (argc, argv) int do_version; /* Set program name for messages. */ - program_name = argv[0]; + set_program_name (argv[0]); error_print_progname = maybe_print_progname; #ifdef HAVE_SETLOCALE diff --git a/src/msgcomm.c b/src/msgcomm.c index 2f236b23c..8e61b3b4c 100644 --- a/src/msgcomm.c +++ b/src/msgcomm.c @@ -143,7 +143,7 @@ main (argc, argv) size_t j; /* Set program name for messages. */ - program_name = argv[0]; + set_program_name (argv[0]); error_print_progname = maybe_print_progname; #ifdef HAVE_SETLOCALE diff --git a/src/msgfmt.c b/src/msgfmt.c index 6b2c681d3..338dc5233 100644 --- a/src/msgfmt.c +++ b/src/msgfmt.c @@ -202,7 +202,7 @@ main (argc, argv) alignment = DEFAULT_OUTPUT_ALIGNMENT; /* Set program name for messages. */ - program_name = argv[0]; + set_program_name (argv[0]); error_print_progname = maybe_print_progname; error_one_per_line = 1; exit_status = EXIT_SUCCESS; diff --git a/src/msgmerge.c b/src/msgmerge.c index a09c3f93f..c7b5729ca 100644 --- a/src/msgmerge.c +++ b/src/msgmerge.c @@ -96,7 +96,7 @@ main (argc, argv) int sort_by_msgid = 0; /* Set program name for messages. */ - program_name = argv[0]; + set_program_name (argv[0]); error_print_progname = maybe_print_progname; verbosity_level = 0; quiet = 0; diff --git a/src/msgunfmt.c b/src/msgunfmt.c index f58bd41a0..46a1cfb15 100644 --- a/src/msgunfmt.c +++ b/src/msgunfmt.c @@ -97,7 +97,7 @@ main (argc, argv) int sort_by_msgid = 0; /* Set program name for messages. */ - program_name = argv[0]; + set_program_name (argv[0]); error_print_progname = maybe_print_progname; #ifdef HAVE_SETLOCALE diff --git a/src/ngettext.c b/src/ngettext.c index 36b1513a2..e08a162f5 100644 --- a/src/ngettext.c +++ b/src/ngettext.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -76,6 +77,8 @@ main (argc, argv) /* Set program name for message texts. */ program_name = argv[0]; + if (strncmp (program_name, "lt-", 3) == 0) + program_name += 3; #ifdef HAVE_SETLOCALE /* Set locale via LC_ALL. */ diff --git a/src/xgettext.c b/src/xgettext.c index 64afb7ae1..d78af98e4 100644 --- a/src/xgettext.c +++ b/src/xgettext.c @@ -213,7 +213,7 @@ main (argc, argv) scanner_fp scanner = NULL; /* Set program name for messages. */ - program_name = argv[0]; + set_program_name (argv[0]); error_print_progname = maybe_print_progname; #ifdef HAVE_SETLOCALE