From: Bruno Haible Date: Sun, 5 Jul 2020 20:47:41 +0000 (+0200) Subject: Avoid possible future conflict with gnulib module 'dirname'. X-Git-Tag: v0.21~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8a344e8f6c73649631dc93d6a0e7fcf10420586;p=thirdparty%2Fgettext.git Avoid possible future conflict with gnulib module 'dirname'. * gnulib-local/lib/basename.c: Remove file. * gnulib-local/lib/basename.h: Remove file. * gnulib-local/modules/basename: Remove file. * gnulib-local/Makefile.am (EXTRA_DIST): Remove them. * gnulib-local/lib/addext.c: Include basename-lgpl.h instead of basename.h. (addext): Invoke last_component instead of basename. * gnulib-local/lib/backupfile.c: Include basename-lgpl.h instead of basename.h. (find_backup_file_name): Invoke last_component instead of basename. * gnulib-local/modules/backupfile (Depends-on): Remove basename. Add basename-lgpl. * autogen.sh (GNULIB_MODULES_RUNTIME_FOR_SRC, GNULIB_MODULES_TOOLS_FOR_SRC, GNULIB_MODULES_LIBGETTEXTPO): Remove basename. Add basename-lgpl. * gettext-runtime/src/envsubst.c: Include basename-lgpl.h instead of basename.h. (main): Invoke last_component instead of basename. * gettext-runtime/src/gettext.c: Likewise. * gettext-runtime/src/ngettext.c: Likewise. * gettext-tools/src/cldr-plurals.c: Likewise. * gettext-tools/src/hostname.c: Likewise. * gettext-tools/src/msgattrib.c: Likewise. * gettext-tools/src/msgcat.c: Likewise. * gettext-tools/src/msgcmp.c: Likewise. * gettext-tools/src/msgcomm.c: Likewise. * gettext-tools/src/msgconv.c: Likewise. * gettext-tools/src/msgen.c: Likewise. * gettext-tools/src/msgexec.c: Likewise. * gettext-tools/src/msgfilter.c: Likewise. * gettext-tools/src/msgfmt.c: Likewise. * gettext-tools/src/msggrep.c: Likewise. * gettext-tools/src/msginit.c: Likewise. * gettext-tools/src/msgmerge.c: Likewise. * gettext-tools/src/msgunfmt.c: Likewise. * gettext-tools/src/msguniq.c: Likewise. * gettext-tools/src/urlget.c: Likewise. * gettext-tools/src/xgettext.c: Likewise. * gettext-tools/tests/tstgettext.c: Likewise. * gettext-tools/tests/tstngettext.c: Likewise. Include . * gettext-tools/src/recode-sr-latin.c: Include basename-lgpl.h instead of basename.h. (main, process): Invoke last_component instead of basename. * gettext-tools/src/locating-rule.c: Include basename-lgpl.h instead of basename.h. (locating_rule_match): Invoke last_component instead of basename. * gettext-tools/src/msgl-cat.c: Include basename-lgpl.h instead of basename.h. (catenate_msgdomain_list): Invoke last_component instead of basename. * gettext-tools/src/msgl-charset.c: Include basename-lgpl.h instead of basename.h. (compare_po_locale_charsets): Invoke last_component instead of basename. * gettext-tools/src/msgl-iconv.c: Include basename-lgpl.h instead of basename.h. (iconv_message_list_internal): Invoke last_component instead of basename. * gettext-tools/src/po-charset.c: Include basename-lgpl.h instead of basename.h. (po_lex_charset_set): Invoke last_component instead of basename. * gettext-tools/src/x-python.c: Include basename-lgpl.h instead of basename.h. (set_current_file_source_encoding): Invoke last_component instead of basename. * gettext-tools/src/x-javascript.c: Don't include basename.h. --- diff --git a/.gitignore b/.gitignore index 51257162c..84cfa688a 100644 --- a/.gitignore +++ b/.gitignore @@ -75,8 +75,6 @@ /gettext-tools/libgettextpo/attribute.h /gettext-tools/libgettextpo/basename-lgpl.c /gettext-tools/libgettextpo/basename-lgpl.h -/gettext-tools/libgettextpo/basename.c -/gettext-tools/libgettextpo/basename.h /gettext-tools/libgettextpo/c-ctype.c /gettext-tools/libgettextpo/c-ctype.h /gettext-tools/libgettextpo/c-strcase.h diff --git a/autogen.sh b/autogen.sh index 5678c5ff9..ca17cd952 100755 --- a/autogen.sh +++ b/autogen.sh @@ -70,7 +70,7 @@ if ! $skip_gnulib; then # In gettext-runtime: GNULIB_MODULES_RUNTIME_FOR_SRC=' atexit - basename + basename-lgpl binary-io closeout error @@ -123,7 +123,7 @@ if ! $skip_gnulib; then alloca-opt atexit backupfile - basename + basename-lgpl binary-io bison bison-i18n @@ -291,7 +291,7 @@ if ! $skip_gnulib; then # In gettext-tools/libgettextpo: # This is a subset of the GNULIB_MODULES_FOR_SRC. GNULIB_MODULES_LIBGETTEXTPO=' - basename + basename-lgpl close c-ctype c-strcase diff --git a/gettext-runtime/src/envsubst.c b/gettext-runtime/src/envsubst.c index 0b5508076..ffe4ce79d 100644 --- a/gettext-runtime/src/envsubst.c +++ b/gettext-runtime/src/envsubst.c @@ -33,7 +33,7 @@ #include "error.h" #include "progname.h" #include "relocatable.h" -#include "basename.h" +#include "basename-lgpl.h" #include "xalloc.h" #include "propername.h" #include "binary-io.h" @@ -104,7 +104,8 @@ main (int argc, char *argv[]) /* Version information is requested. */ if (do_version) { - printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION); + printf ("%s (GNU %s) %s\n", last_component (program_name), + PACKAGE, VERSION); /* xgettext: no-wrap */ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv3+: GNU GPL version 3 or later <%s>\n\ diff --git a/gettext-runtime/src/gettext.c b/gettext-runtime/src/gettext.c index 50770cf5c..99fd82d6a 100644 --- a/gettext-runtime/src/gettext.c +++ b/gettext-runtime/src/gettext.c @@ -32,7 +32,7 @@ #include "error.h" #include "progname.h" #include "relocatable.h" -#include "basename.h" +#include "basename-lgpl.h" #include "xalloc.h" #include "propername.h" #include "escapes.h" @@ -129,7 +129,8 @@ main (int argc, char *argv[]) /* Version information is requested. */ if (do_version) { - printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION); + printf ("%s (GNU %s) %s\n", last_component (program_name), + PACKAGE, VERSION); /* xgettext: no-wrap */ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv3+: GNU GPL version 3 or later <%s>\n\ diff --git a/gettext-runtime/src/ngettext.c b/gettext-runtime/src/ngettext.c index 841665c61..d10f2c3c7 100644 --- a/gettext-runtime/src/ngettext.c +++ b/gettext-runtime/src/ngettext.c @@ -31,7 +31,7 @@ #include "error.h" #include "progname.h" #include "relocatable.h" -#include "basename.h" +#include "basename-lgpl.h" #include "xalloc.h" #include "propername.h" #include "escapes.h" @@ -118,7 +118,8 @@ main (int argc, char *argv[]) /* Version information is requested. */ if (do_version) { - printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION); + printf ("%s (GNU %s) %s\n", last_component (program_name), + PACKAGE, VERSION); /* xgettext: no-wrap */ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv3+: GNU GPL version 3 or later <%s>\n\ diff --git a/gettext-tools/src/cldr-plurals.c b/gettext-tools/src/cldr-plurals.c index ac0e693ed..94a2cdf79 100644 --- a/gettext-tools/src/cldr-plurals.c +++ b/gettext-tools/src/cldr-plurals.c @@ -20,7 +20,7 @@ # include #endif -#include "basename.h" +#include "basename-lgpl.h" #include "cldr-plural-exp.h" #include "closeout.h" #include "c-ctype.h" @@ -286,7 +286,8 @@ main (int argc, char **argv) /* Version information requested. */ if (do_version) { - printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION); + printf ("%s (GNU %s) %s\n", last_component (program_name), + PACKAGE, VERSION); /* xgettext: no-wrap */ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv3+: GNU GPL version 3 or later <%s>\n\ diff --git a/gettext-tools/src/hostname.c b/gettext-tools/src/hostname.c index cead2cfaa..295b0b4ee 100644 --- a/gettext-tools/src/hostname.c +++ b/gettext-tools/src/hostname.c @@ -87,7 +87,7 @@ #include "error-progname.h" #include "progname.h" #include "relocatable.h" -#include "basename.h" +#include "basename-lgpl.h" #include "xalloc.h" #include "propername.h" #include "gettext.h" @@ -171,7 +171,8 @@ main (int argc, char *argv[]) /* Version information requested. */ if (do_version) { - printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION); + printf ("%s (GNU %s) %s\n", last_component (program_name), + PACKAGE, VERSION); /* xgettext: no-wrap */ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv3+: GNU GPL version 3 or later <%s>\n\ diff --git a/gettext-tools/src/locating-rule.c b/gettext-tools/src/locating-rule.c index 1a54d4d28..15faee121 100644 --- a/gettext-tools/src/locating-rule.c +++ b/gettext-tools/src/locating-rule.c @@ -23,7 +23,7 @@ /* Specification. */ #include "locating-rule.h" -#include "basename.h" +#include "basename-lgpl.h" #include "concat-filename.h" #include "c-strcase.h" @@ -146,7 +146,7 @@ locating_rule_match (struct locating_rule_ty *rule, && memcmp (reduced + strlen (reduced) - 3, ".in", 3) == 0) reduced[strlen (reduced) - 3] = '\0'; - err = fnmatch (rule->pattern, basename (reduced), FNM_PATHNAME); + err = fnmatch (rule->pattern, last_component (reduced), FNM_PATHNAME); free (reduced); if (err != 0) return NULL; diff --git a/gettext-tools/src/msgattrib.c b/gettext-tools/src/msgattrib.c index 7e6f2ff3c..f9d60d1d8 100644 --- a/gettext-tools/src/msgattrib.c +++ b/gettext-tools/src/msgattrib.c @@ -36,7 +36,7 @@ #include "error-progname.h" #include "progname.h" #include "relocatable.h" -#include "basename.h" +#include "basename-lgpl.h" #include "message.h" #include "read-catalog.h" #include "read-po.h" @@ -347,7 +347,8 @@ main (int argc, char **argv) /* Version information requested. */ if (do_version) { - printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION); + printf ("%s (GNU %s) %s\n", last_component (program_name), + PACKAGE, VERSION); /* xgettext: no-wrap */ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv3+: GNU GPL version 3 or later <%s>\n\ diff --git a/gettext-tools/src/msgcat.c b/gettext-tools/src/msgcat.c index d58ee91ff..a8c4d5032 100644 --- a/gettext-tools/src/msgcat.c +++ b/gettext-tools/src/msgcat.c @@ -37,7 +37,7 @@ #include "error-progname.h" #include "progname.h" #include "relocatable.h" -#include "basename.h" +#include "basename-lgpl.h" #include "message.h" #include "read-catalog.h" #include "read-po.h" @@ -285,7 +285,8 @@ main (int argc, char **argv) /* Version information requested. */ if (do_version) { - printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION); + printf ("%s (GNU %s) %s\n", last_component (program_name), + PACKAGE, VERSION); /* xgettext: no-wrap */ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv3+: GNU GPL version 3 or later <%s>\n\ diff --git a/gettext-tools/src/msgcmp.c b/gettext-tools/src/msgcmp.c index 2dfb74973..7d9478d62 100644 --- a/gettext-tools/src/msgcmp.c +++ b/gettext-tools/src/msgcmp.c @@ -34,7 +34,7 @@ #include "error-progname.h" #include "progname.h" #include "relocatable.h" -#include "basename.h" +#include "basename-lgpl.h" #include "message.h" #include "read-catalog.h" #include "read-po.h" @@ -163,7 +163,8 @@ main (int argc, char *argv[]) /* Version information is requested. */ if (do_version) { - printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION); + printf ("%s (GNU %s) %s\n", last_component (program_name), + PACKAGE, VERSION); /* xgettext: no-wrap */ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv3+: GNU GPL version 3 or later <%s>\n\ diff --git a/gettext-tools/src/msgcomm.c b/gettext-tools/src/msgcomm.c index ed362dad0..e24a61ef6 100644 --- a/gettext-tools/src/msgcomm.c +++ b/gettext-tools/src/msgcomm.c @@ -37,7 +37,7 @@ #include "error-progname.h" #include "progname.h" #include "relocatable.h" -#include "basename.h" +#include "basename-lgpl.h" #include "message.h" #include "read-catalog.h" #include "read-po.h" @@ -276,7 +276,8 @@ main (int argc, char *argv[]) /* Version information requested. */ if (do_version) { - printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION); + printf ("%s (GNU %s) %s\n", last_component (program_name), + PACKAGE, VERSION); /* xgettext: no-wrap */ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv3+: GNU GPL version 3 or later <%s>\n\ diff --git a/gettext-tools/src/msgconv.c b/gettext-tools/src/msgconv.c index d4f1e531b..e7fa05404 100644 --- a/gettext-tools/src/msgconv.c +++ b/gettext-tools/src/msgconv.c @@ -36,7 +36,7 @@ #include "error-progname.h" #include "progname.h" #include "relocatable.h" -#include "basename.h" +#include "basename-lgpl.h" #include "message.h" #include "read-catalog.h" #include "read-po.h" @@ -236,7 +236,8 @@ main (int argc, char **argv) /* Version information is requested. */ if (do_version) { - printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION); + printf ("%s (GNU %s) %s\n", last_component (program_name), + PACKAGE, VERSION); /* xgettext: no-wrap */ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv3+: GNU GPL version 3 or later <%s>\n\ diff --git a/gettext-tools/src/msgen.c b/gettext-tools/src/msgen.c index 960adda14..40ca9de74 100644 --- a/gettext-tools/src/msgen.c +++ b/gettext-tools/src/msgen.c @@ -36,7 +36,7 @@ #include "error-progname.h" #include "progname.h" #include "relocatable.h" -#include "basename.h" +#include "basename-lgpl.h" #include "message.h" #include "read-catalog.h" #include "read-po.h" @@ -233,7 +233,8 @@ main (int argc, char **argv) /* Version information is requested. */ if (do_version) { - printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION); + printf ("%s (GNU %s) %s\n", last_component (program_name), + PACKAGE, VERSION); /* xgettext: no-wrap */ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv3+: GNU GPL version 3 or later <%s>\n\ diff --git a/gettext-tools/src/msgexec.c b/gettext-tools/src/msgexec.c index 13411da38..811e0fa09 100644 --- a/gettext-tools/src/msgexec.c +++ b/gettext-tools/src/msgexec.c @@ -39,7 +39,7 @@ #include "error-progname.h" #include "progname.h" #include "relocatable.h" -#include "basename.h" +#include "basename-lgpl.h" #include "message.h" #include "read-catalog.h" #include "read-po.h" @@ -177,7 +177,8 @@ main (int argc, char **argv) /* Version information is requested. */ if (do_version) { - printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION); + printf ("%s (GNU %s) %s\n", last_component (program_name), + PACKAGE, VERSION); /* xgettext: no-wrap */ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv3+: GNU GPL version 3 or later <%s>\n\ diff --git a/gettext-tools/src/msgfilter.c b/gettext-tools/src/msgfilter.c index f5e4e64fe..726d1215f 100644 --- a/gettext-tools/src/msgfilter.c +++ b/gettext-tools/src/msgfilter.c @@ -40,7 +40,7 @@ #include "error-progname.h" #include "progname.h" #include "relocatable.h" -#include "basename.h" +#include "basename-lgpl.h" #include "message.h" #include "read-catalog.h" #include "read-po.h" @@ -280,7 +280,8 @@ main (int argc, char **argv) /* Version information is requested. */ if (do_version) { - printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION); + printf ("%s (GNU %s) %s\n", last_component (program_name), + PACKAGE, VERSION); /* xgettext: no-wrap */ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv3+: GNU GPL version 3 or later <%s>\n\ diff --git a/gettext-tools/src/msgfmt.c b/gettext-tools/src/msgfmt.c index 4da5bfa0d..f990152d2 100644 --- a/gettext-tools/src/msgfmt.c +++ b/gettext-tools/src/msgfmt.c @@ -39,7 +39,7 @@ #include "error-progname.h" #include "progname.h" #include "relocatable.h" -#include "basename.h" +#include "basename-lgpl.h" #include "xerror.h" #include "xvasprintf.h" #include "xalloc.h" @@ -436,7 +436,8 @@ main (int argc, char *argv[]) /* Version information is requested. */ if (do_version) { - printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION); + printf ("%s (GNU %s) %s\n", last_component (program_name), + PACKAGE, VERSION); /* xgettext: no-wrap */ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv3+: GNU GPL version 3 or later <%s>\n\ diff --git a/gettext-tools/src/msggrep.c b/gettext-tools/src/msggrep.c index 6bb1a74a4..f14ed69db 100644 --- a/gettext-tools/src/msggrep.c +++ b/gettext-tools/src/msggrep.c @@ -47,7 +47,7 @@ #include "error-progname.h" #include "progname.h" #include "relocatable.h" -#include "basename.h" +#include "basename-lgpl.h" #include "message.h" #include "read-catalog.h" #include "read-po.h" @@ -407,7 +407,8 @@ main (int argc, char **argv) /* Version information is requested. */ if (do_version) { - printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION); + printf ("%s (GNU %s) %s\n", last_component (program_name), + PACKAGE, VERSION); /* xgettext: no-wrap */ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv3+: GNU GPL version 3 or later <%s>\n\ diff --git a/gettext-tools/src/msginit.c b/gettext-tools/src/msginit.c index ff0b7d782..9a227ba56 100644 --- a/gettext-tools/src/msginit.c +++ b/gettext-tools/src/msginit.c @@ -60,7 +60,7 @@ #include "error-progname.h" #include "progname.h" #include "relocatable.h" -#include "basename.h" +#include "basename-lgpl.h" #include "c-strstr.h" #include "c-strcase.h" #include "message.h" @@ -263,7 +263,8 @@ main (int argc, char **argv) /* Version information is requested. */ if (do_version) { - printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION); + printf ("%s (GNU %s) %s\n", last_component (program_name), + PACKAGE, VERSION); /* xgettext: no-wrap */ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv3+: GNU GPL version 3 or later <%s>\n\ diff --git a/gettext-tools/src/msgl-cat.c b/gettext-tools/src/msgl-cat.c index 2e806497c..990d39e92 100644 --- a/gettext-tools/src/msgl-cat.c +++ b/gettext-tools/src/msgl-cat.c @@ -1,5 +1,5 @@ /* Message list concatenation and duplicate handling. - Copyright (C) 2001-2003, 2005-2008, 2012, 2015, 2019 Free Software + Copyright (C) 2001-2003, 2005-2008, 2012, 2015, 2019-2020 Free Software Foundation, Inc. Written by Bruno Haible , 2001. @@ -43,7 +43,7 @@ #include "xalloc.h" #include "xmalloca.h" #include "c-strstr.h" -#include "basename.h" +#include "basename-lgpl.h" #include "gettext.h" #define _(str) gettext (str) @@ -217,7 +217,7 @@ catenate_msgdomain_list (string_list_ty *file_list, identifications = XNMALLOC (nfiles, const char **); for (n = 0; n < nfiles; n++) { - const char *filename = basename (files[n]); + const char *filename = last_component (files[n]); msgdomain_list_ty *mdlp = mdlps[n]; size_t k; diff --git a/gettext-tools/src/msgl-charset.c b/gettext-tools/src/msgl-charset.c index 42d182e91..9cf0cc424 100644 --- a/gettext-tools/src/msgl-charset.c +++ b/gettext-tools/src/msgl-charset.c @@ -1,5 +1,5 @@ /* Message list charset and locale charset handling. - Copyright (C) 2001-2003, 2005-2007, 2009, 2019 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2007, 2009, 2019-2020 Free Software Foundation, Inc. Written by Bruno Haible , 2001. This program is free software: you can redistribute it and/or modify @@ -32,7 +32,7 @@ #include "localcharset.h" #include "error.h" #include "progname.h" -#include "basename.h" +#include "basename-lgpl.h" #include "xmalloca.h" #include "xerror.h" #include "xvasprintf.h" @@ -94,7 +94,7 @@ Locale charset \"%s\" is different from\n\ input file charset \"%s\".\n\ Output of '%s' might be incorrect.\n\ Possible workarounds are:\n\ -"), locale_code, canon_charset, basename (program_name))); +"), locale_code, canon_charset, last_component (program_name))); multiline_warning (NULL, xasprintf (_("\ - Set LC_ALL to a locale with encoding %s.\n\ @@ -105,7 +105,7 @@ Possible workarounds are:\n\ - Convert the translation catalog to %s using 'msgconv',\n\ then apply '%s',\n\ then convert back to %s using 'msgconv'.\n\ -"), canon_locale_code, basename (program_name), canon_charset)); +"), canon_locale_code, last_component (program_name), canon_charset)); if (strcmp (canon_charset, "UTF-8") != 0 && (canon_locale_code == NULL || strcmp (canon_locale_code, "UTF-8") != 0)) @@ -115,7 +115,7 @@ Possible workarounds are:\n\ convert the translation catalog to %s using 'msgconv',\n\ then apply '%s',\n\ then convert back to %s using 'msgconv'.\n\ -"), "UTF-8", "UTF-8", basename (program_name), canon_charset)); +"), "UTF-8", "UTF-8", last_component (program_name), canon_charset)); warned = true; } } @@ -128,5 +128,5 @@ Possible workarounds are:\n\ Locale charset \"%s\" is not a portable encoding name.\n\ Output of '%s' might be incorrect.\n\ A possible workaround is to set LC_ALL=C.\n\ -"), locale_code, basename (program_name))); +"), locale_code, last_component (program_name))); } diff --git a/gettext-tools/src/msgl-iconv.c b/gettext-tools/src/msgl-iconv.c index c66d14a0b..0b5ed107e 100644 --- a/gettext-tools/src/msgl-iconv.c +++ b/gettext-tools/src/msgl-iconv.c @@ -34,7 +34,7 @@ #include "noreturn.h" #include "progname.h" -#include "basename.h" +#include "basename-lgpl.h" #include "message.h" #include "po-charset.h" #include "xstriconv.h" @@ -298,7 +298,7 @@ iconv_message_list_internal (message_list_ty *mlp, po_xerror (PO_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false, xasprintf (_("Cannot convert from \"%s\" to \"%s\". %s relies on iconv(), and iconv() does not support this conversion."), canon_from_code, canon_to_code, - basename (program_name))); + last_component (program_name))); context.from_code = canon_from_code; context.to_code = canon_to_code; @@ -330,7 +330,7 @@ iconv_message_list_internal (message_list_ty *mlp, po_xerror (PO_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false, xasprintf (_("Cannot convert from \"%s\" to \"%s\". %s relies on iconv(). This version was built without iconv()."), canon_from_code, canon_to_code, - basename (program_name))); + last_component (program_name))); #endif } diff --git a/gettext-tools/src/msgmerge.c b/gettext-tools/src/msgmerge.c index 42facb280..338532a86 100644 --- a/gettext-tools/src/msgmerge.c +++ b/gettext-tools/src/msgmerge.c @@ -41,7 +41,7 @@ #include "error-progname.h" #include "progname.h" #include "relocatable.h" -#include "basename.h" +#include "basename-lgpl.h" #include "message.h" #include "read-catalog.h" #include "read-po.h" @@ -364,7 +364,8 @@ main (int argc, char **argv) /* Version information is requested. */ if (do_version) { - printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION); + printf ("%s (GNU %s) %s\n", last_component (program_name), + PACKAGE, VERSION); /* xgettext: no-wrap */ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv3+: GNU GPL version 3 or later <%s>\n\ diff --git a/gettext-tools/src/msgunfmt.c b/gettext-tools/src/msgunfmt.c index 8120316c9..030f33206 100644 --- a/gettext-tools/src/msgunfmt.c +++ b/gettext-tools/src/msgunfmt.c @@ -35,7 +35,7 @@ #include "error-progname.h" #include "progname.h" #include "relocatable.h" -#include "basename.h" +#include "basename-lgpl.h" #include "message.h" #include "msgunfmt.h" #include "read-mo.h" @@ -254,7 +254,8 @@ main (int argc, char **argv) /* Version information is requested. */ if (do_version) { - printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION); + printf ("%s (GNU %s) %s\n", last_component (program_name), + PACKAGE, VERSION); /* xgettext: no-wrap */ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv3+: GNU GPL version 3 or later <%s>\n\ diff --git a/gettext-tools/src/msguniq.c b/gettext-tools/src/msguniq.c index 6616ced3e..2a18b2279 100644 --- a/gettext-tools/src/msguniq.c +++ b/gettext-tools/src/msguniq.c @@ -37,7 +37,7 @@ #include "error-progname.h" #include "progname.h" #include "relocatable.h" -#include "basename.h" +#include "basename-lgpl.h" #include "message.h" #include "read-catalog.h" #include "read-po.h" @@ -256,7 +256,8 @@ main (int argc, char **argv) /* Version information requested. */ if (do_version) { - printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION); + printf ("%s (GNU %s) %s\n", last_component (program_name), + PACKAGE, VERSION); /* xgettext: no-wrap */ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv3+: GNU GPL version 3 or later <%s>\n\ diff --git a/gettext-tools/src/po-charset.c b/gettext-tools/src/po-charset.c index 703b6f9d8..2e92c69e2 100644 --- a/gettext-tools/src/po-charset.c +++ b/gettext-tools/src/po-charset.c @@ -1,5 +1,5 @@ /* Charset handling while reading PO files. - Copyright (C) 2001-2007, 2010, 2019 Free Software Foundation, Inc. + Copyright (C) 2001-2007, 2010, 2019-2020 Free Software Foundation, Inc. Written by Bruno Haible , 2001. This program is free software: you can redistribute it and/or modify @@ -31,7 +31,7 @@ #include "xvasprintf.h" #include "po-xerror.h" #if !IN_LIBGETTEXTPO -# include "basename.h" +# include "basename-lgpl.h" # include "progname.h" #endif #include "c-strstr.h" @@ -559,7 +559,7 @@ Message conversion to user's charset might not work.\n"), # if IN_LIBGETTEXTPO progname = "libgettextpo"; # else - progname = basename (program_name); + progname = last_component (program_name); # endif warning_message = @@ -615,7 +615,7 @@ would fix this problem.\n"); # if IN_LIBGETTEXTPO progname = "libgettextpo"; # else - progname = basename (program_name); + progname = last_component (program_name); # endif warning_message = diff --git a/gettext-tools/src/recode-sr-latin.c b/gettext-tools/src/recode-sr-latin.c index 23d21cde4..a7f67ba90 100644 --- a/gettext-tools/src/recode-sr-latin.c +++ b/gettext-tools/src/recode-sr-latin.c @@ -36,7 +36,7 @@ #include "error.h" #include "progname.h" #include "relocatable.h" -#include "basename.h" +#include "basename-lgpl.h" #include "xalloc.h" #include "localcharset.h" #include "c-strcase.h" @@ -101,7 +101,8 @@ main (int argc, char *argv[]) /* Version information is requested. */ if (do_version) { - printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION); + printf ("%s (GNU %s) %s\n", last_component (program_name), + PACKAGE, VERSION); /* xgettext: no-wrap */ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv3+: GNU GPL version 3 or later <%s>\n\ @@ -288,11 +289,11 @@ process (FILE *stream) if (conv_to_utf8 == (iconv_t)(-1)) error (EXIT_FAILURE, 0, _("Cannot convert from \"%s\" to \"%s\". %s relies on iconv(), and iconv() does not support this conversion."), - locale_code, "UTF-8", basename (program_name)); + locale_code, "UTF-8", last_component (program_name)); if (conv_from_utf8 == (iconv_t)(-1)) error (EXIT_FAILURE, 0, _("Cannot convert from \"%s\" to \"%s\". %s relies on iconv(), and iconv() does not support this conversion."), - "UTF-8", locale_code, basename (program_name)); + "UTF-8", locale_code, last_component (program_name)); last_utf8_line = NULL; last_utf8_line_len = 0; last_backconv_line = NULL; @@ -300,7 +301,7 @@ process (FILE *stream) #else error (EXIT_FAILURE, 0, _("Cannot convert from \"%s\" to \"%s\". %s relies on iconv(). This version was built without iconv()."), - locale_code, "UTF-8", basename (program_name)); + locale_code, "UTF-8", last_component (program_name)); #endif } diff --git a/gettext-tools/src/urlget.c b/gettext-tools/src/urlget.c index 97e9d0fda..84e20043d 100644 --- a/gettext-tools/src/urlget.c +++ b/gettext-tools/src/urlget.c @@ -36,7 +36,7 @@ #include "error-progname.h" #include "progname.h" #include "relocatable.h" -#include "basename.h" +#include "basename-lgpl.h" #include "full-write.h" #include "execute.h" #include "javaexec.h" @@ -134,7 +134,8 @@ main (int argc, char *argv[]) /* Version information requested. */ if (do_version) { - printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION); + printf ("%s (GNU %s) %s\n", last_component (program_name), + PACKAGE, VERSION); /* xgettext: no-wrap */ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv3+: GNU GPL version 3 or later <%s>\n\ diff --git a/gettext-tools/src/x-javascript.c b/gettext-tools/src/x-javascript.c index 34da71760..54ab51a7b 100644 --- a/gettext-tools/src/x-javascript.c +++ b/gettext-tools/src/x-javascript.c @@ -44,7 +44,6 @@ #include "error.h" #include "error-progname.h" #include "progname.h" -#include "basename.h" #include "xerror.h" #include "xvasprintf.h" #include "xalloc.h" diff --git a/gettext-tools/src/x-python.c b/gettext-tools/src/x-python.c index ed319f13a..1dee06100 100644 --- a/gettext-tools/src/x-python.c +++ b/gettext-tools/src/x-python.c @@ -43,7 +43,7 @@ #include "error.h" #include "error-progname.h" #include "progname.h" -#include "basename.h" +#include "basename-lgpl.h" #include "xerror.h" #include "xvasprintf.h" #include "xalloc.h" @@ -623,13 +623,13 @@ set_current_file_source_encoding (const char *canon_encoding) error_at_line (EXIT_FAILURE, 0, logical_file_name, line_number - 1, _("Cannot convert from \"%s\" to \"%s\". %s relies on iconv(), and iconv() does not support this conversion."), xgettext_current_file_source_encoding, po_charset_utf8, - basename (program_name)); + last_component (program_name)); xgettext_current_file_source_iconv = cd; #else error_at_line (EXIT_FAILURE, 0, logical_file_name, line_number - 1, _("Cannot convert from \"%s\" to \"%s\". %s relies on iconv(). This version was built without iconv()."), xgettext_current_file_source_encoding, po_charset_utf8, - basename (program_name)); + last_component (program_name)); #endif } diff --git a/gettext-tools/src/xgettext.c b/gettext-tools/src/xgettext.c index c4b2527e1..9b8786ebf 100644 --- a/gettext-tools/src/xgettext.c +++ b/gettext-tools/src/xgettext.c @@ -54,7 +54,7 @@ #include "error-progname.h" #include "progname.h" #include "relocatable.h" -#include "basename.h" +#include "basename-lgpl.h" #include "xerror.h" #include "xvasprintf.h" #include "xalloc.h" @@ -680,7 +680,8 @@ main (int argc, char *argv[]) /* Version information requested. */ if (do_version) { - printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION); + printf ("%s (GNU %s) %s\n", last_component (program_name), + PACKAGE, VERSION); /* xgettext: no-wrap */ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv3+: GNU GPL version 3 or later <%s>\n\ @@ -805,13 +806,13 @@ xgettext cannot work without keywords to look for")); error (EXIT_FAILURE, 0, _("Cannot convert from \"%s\" to \"%s\". %s relies on iconv(), and iconv() does not support this conversion."), xgettext_global_source_encoding, po_charset_utf8, - basename (program_name)); + last_component (program_name)); xgettext_global_source_iconv = cd; #else error (EXIT_FAILURE, 0, _("Cannot convert from \"%s\" to \"%s\". %s relies on iconv(). This version was built without iconv()."), xgettext_global_source_encoding, po_charset_utf8, - basename (program_name)); + last_component (program_name)); #endif } diff --git a/gettext-tools/tests/tstgettext.c b/gettext-tools/tests/tstgettext.c index cff65313b..a706d9768 100644 --- a/gettext-tools/tests/tstgettext.c +++ b/gettext-tools/tests/tstgettext.c @@ -32,7 +32,7 @@ #include "error.h" #include "progname.h" #include "relocatable.h" -#include "basename.h" +#include "basename-lgpl.h" #include "xalloc.h" #include "propername.h" #include "xsetenv.h" @@ -153,7 +153,8 @@ main (int argc, char *argv[]) /* Version information is requested. */ if (do_version) { - printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION); + printf ("%s (GNU %s) %s\n", last_component (program_name), + PACKAGE, VERSION); /* xgettext: no-wrap */ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv3+: GNU GPL version 3 or later <%s>\n\ diff --git a/gettext-tools/tests/tstngettext.c b/gettext-tools/tests/tstngettext.c index eef1cdee0..1ef13bb41 100644 --- a/gettext-tools/tests/tstngettext.c +++ b/gettext-tools/tests/tstngettext.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -31,7 +32,7 @@ #include "error.h" #include "progname.h" #include "relocatable.h" -#include "basename.h" +#include "basename-lgpl.h" #include "propername.h" #include "xsetenv.h" @@ -129,7 +130,8 @@ main (int argc, char *argv[]) /* Version information is requested. */ if (do_version) { - printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION); + printf ("%s (GNU %s) %s\n", last_component (program_name), + PACKAGE, VERSION); /* xgettext: no-wrap */ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ License GPLv3+: GNU GPL version 3 or later <%s>\n\ diff --git a/gnulib-local/Makefile.am b/gnulib-local/Makefile.am index f89e003f5..298c4f604 100644 --- a/gnulib-local/Makefile.am +++ b/gnulib-local/Makefile.am @@ -24,8 +24,6 @@ lib/alloca.in.h \ lib/argmatch.h.diff \ lib/backupfile.c \ lib/backupfile.h \ -lib/basename.c \ -lib/basename.h \ lib/closeout.c \ lib/closeout.h \ lib/diffseq.h.diff \ @@ -158,7 +156,6 @@ m4/backupfile.m4 \ m4/java.m4 \ m4/libxml.m4 \ modules/backupfile \ -modules/basename \ modules/closeout \ modules/error-progname \ modules/gettext-runtime-misc \ diff --git a/gnulib-local/lib/addext.c b/gnulib-local/lib/addext.c index f76eef816..074dd04c0 100644 --- a/gnulib-local/lib/addext.c +++ b/gnulib-local/lib/addext.c @@ -1,5 +1,5 @@ /* addext.c -- add an extension to a file name - Copyright (C) 1990, 1997-1999, 2001-2003, 2005-2006 Free Software + Copyright (C) 1990, 1997-1999, 2001-2003, 2005-2006, 2020 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -42,7 +42,7 @@ #include -#include "basename.h" +#include "basename-lgpl.h" /* Append to FILENAME the extension EXT, unless the result would be too long, in which case just append the character E. */ @@ -50,7 +50,7 @@ void addext (char *filename, char const *ext, char e) { - char *s = basename (filename); + char *s = last_component (filename); size_t slen = strlen (s), extlen = strlen (ext); long slen_max = -1; diff --git a/gnulib-local/lib/backupfile.c b/gnulib-local/lib/backupfile.c index 624092c46..15595c16a 100644 --- a/gnulib-local/lib/backupfile.c +++ b/gnulib-local/lib/backupfile.c @@ -1,5 +1,5 @@ /* backupfile.c -- make Emacs style backup file names - Copyright (C) 1990-2003, 2005-2006, 2012 Free Software Foundation, Inc. + Copyright (C) 1990-2003, 2005-2006, 2012, 2020 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,7 +36,7 @@ #include -#include "basename.h" +#include "basename-lgpl.h" #if HAVE_DIRENT_H # define HAVE_DIR 1 @@ -105,7 +105,7 @@ find_backup_file_name (const char *file, enum backup_type backup_type) if (backup_type != simple) { int highest_backup; - size_t dir_len = basename (s) - s; + size_t dir_len = last_component (s) - s; strcpy (s + dir_len, "."); highest_backup = max_backup_version (file + dir_len, s); diff --git a/gnulib-local/lib/basename.c b/gnulib-local/lib/basename.c deleted file mode 100644 index e1da9ab3d..000000000 --- a/gnulib-local/lib/basename.c +++ /dev/null @@ -1,84 +0,0 @@ -/* Return the name-within-directory of a file name. - Copyright (C) 1996-2002, 2004, 2006, 2010, 2012, 2018 Free Software Foundation, Inc. - - NOTE: The canonical source of this file is maintained with the GNU C Library. - Bugs can be reported to bug-glibc@gnu.org. - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 3 of the License, or any - later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#include - -/* Specification. */ -#include "basename.h" - -#if !(__GLIBC__ >= 2 || defined __UCLIBC__) - -#include -#include - -#if defined _WIN32 || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ - /* Win32, Cygwin, OS/2, DOS */ -# define HAS_DEVICE(P) \ - ((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \ - && (P)[1] == ':') -# define FILE_SYSTEM_PREFIX_LEN(P) (HAS_DEVICE (P) ? 2 : 0) -# define ISSLASH(C) ((C) == '/' || (C) == '\\') -#endif - -#ifndef FILE_SYSTEM_PREFIX_LEN -# define FILE_SYSTEM_PREFIX_LEN(Filename) 0 -#endif - -#ifndef ISSLASH -# define ISSLASH(C) ((C) == '/') -#endif - -#ifndef _LIBC -/* We cannot generally use the name 'basename' since XPG defines an unusable - variant of the function but we cannot use it. */ -# undef basename -# define basename gnu_basename -#endif - -/* In general, we can't use the builtin 'basename' function if available, - since it has different meanings in different environments. - In some environments the builtin 'basename' modifies its argument. - If NAME is all slashes, be sure to return '/'. */ - -char * -basename (char const *name) -{ - char const *base = name += FILE_SYSTEM_PREFIX_LEN (name); - int all_slashes = 1; - char const *p; - - for (p = name; *p; p++) - { - if (ISSLASH (*p)) - base = p + 1; - else - all_slashes = 0; - } - - /* If NAME is all slashes, arrange to return '/'. */ - if (*base == '\0' && ISSLASH (*name) && all_slashes) - --base; - - /* Make sure the last byte is not a slash. */ - assert (all_slashes || !ISSLASH (*(p - 1))); - - return (char *) base; -} - -#endif diff --git a/gnulib-local/lib/basename.h b/gnulib-local/lib/basename.h deleted file mode 100644 index c1345b92b..000000000 --- a/gnulib-local/lib/basename.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Pathname hacking. - Copyright (C) 2001-2003, 2010 Free Software Foundation, Inc. - Written by Bruno Haible , 2001. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#ifndef _BASENAME_H -#define _BASENAME_H - -/* This is where basename() is declared. */ -#include - - -#ifdef __cplusplus -extern "C" { -#endif - - -#if !(__GLIBC__ >= 2 || defined __UCLIBC__) -/* When not using the GNU libc we use the basename implementation we - provide here. */ -extern char *gnu_basename (const char *); -#define basename(Arg) gnu_basename (Arg) -#endif - - -#ifdef __cplusplus -} -#endif - - -#endif /* _BASENAME_H */ diff --git a/gnulib-local/modules/backupfile b/gnulib-local/modules/backupfile index 0f0288a4f..f70007887 100644 --- a/gnulib-local/modules/backupfile +++ b/gnulib-local/modules/backupfile @@ -9,7 +9,7 @@ m4/backupfile.m4 Depends-on: argmatch -basename +basename-lgpl closedir opendir readdir diff --git a/gnulib-local/modules/basename b/gnulib-local/modules/basename deleted file mode 100644 index 359a1267b..000000000 --- a/gnulib-local/modules/basename +++ /dev/null @@ -1,23 +0,0 @@ -Description: -Return the name-within-directory of a file name. - -Files: -lib/basename.h -lib/basename.c - -Depends-on: - -configure.ac: - -Makefile.am: -lib_SOURCES += basename.h basename.c - -Include: -"basename.h" - -License: -GPL - -Maintainer: -Bruno Haible -