+2001-05-15 Bruno Haible <haible@clisp.cons.org>
+
+ * progname.h (set_program_name): New declaration.
+ * progname.c: Include <string.h>.
+ (set_program_name): New function.
+
2001-05-02 Bruno Haible <haible@clisp.cons.org>
* xerror.h: New file.
#endif
#include <stdio.h>
+#include <string.h>
#include "progname.h"
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;
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'
+2001-05-15 Bruno Haible <haible@clisp.cons.org>
+
+ * 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 <haible@clisp.cons.org>
* gettext.c (usage): Add description of what the program does.
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <locale.h>
#include "error.h"
/* 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. */
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
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
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;
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;
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
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <locale.h>
#include <errno.h>
/* 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. */
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