From: Bruno Haible Date: Fri, 28 Sep 2001 20:20:05 +0000 (+0000) Subject: New include file "basename.h". X-Git-Tag: v0.11~450 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87bf419a22ef361599e33cf2817e6f8aaa463fd2;p=thirdparty%2Fgettext.git New include file "basename.h". --- diff --git a/lib/ChangeLog b/lib/ChangeLog index 04a1cd749..73b737ed0 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,11 @@ +2001-09-17 Bruno Haible + + * basename.h: New file. + * basename.c: Include it. Don't compile the function if already + present in the GNU C library. + * Makefile.am (libnlsut_a_HEADER): Add basename.h. + * system.h (gnu_basename, basename): Remove. + 2001-09-09 Bruno Haible * xmalloc.h: New file. diff --git a/lib/Makefile.am b/lib/Makefile.am index 3adfb832e..c7cc946ca 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -29,10 +29,10 @@ linebreak.c localcharset.c mbswidth.c obstack.c pipe-bidi.c pipe-in.c \ pipe-out.c progname.c sh-quote.c tmpdir.c wait-process.c xerror.c xgetcwd.c \ xmalloc.c xstrdup.c -libnlsut_a_HEADER = c-ctype.h execute.h findprog.h fstrcmp.h full-write.h \ -gcd.h getopt.h hash.h javacomp.h javaexec.h lbrkprop.h linebreak.h mbswidth.h \ -obstack.h pathmax.h pipe.h progname.h sh-quote.h system.h tmpdir.h \ -utf8-ucs4.h utf16-ucs4.h wait-process.h xerror.h xmalloc.h +libnlsut_a_HEADER = basename.h c-ctype.h execute.h findprog.h fstrcmp.h \ +full-write.h gcd.h getopt.h hash.h javacomp.h javaexec.h lbrkprop.h \ +linebreak.h mbswidth.h obstack.h pathmax.h pipe.h progname.h sh-quote.h \ +system.h tmpdir.h utf8-ucs4.h utf16-ucs4.h wait-process.h xerror.h xmalloc.h # Sources that are compiled only on platforms that lack the functions. diff --git a/lib/basename.c b/lib/basename.c index d3b81aa28..ca0b589f4 100644 --- a/lib/basename.c +++ b/lib/basename.c @@ -23,6 +23,11 @@ # include #endif +/* Specification. */ +#include "basename.h" + +#ifndef __GNU_LIBRARY__ + #include #include @@ -70,3 +75,5 @@ basename (name) return (char *) base; } + +#endif diff --git a/lib/basename.h b/lib/basename.h new file mode 100644 index 000000000..6093e3892 --- /dev/null +++ b/lib/basename.h @@ -0,0 +1,32 @@ +/* Pathname hacking. + Copyright (C) 2001 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 2, 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, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef _BASENAME_H +#define _BASENAME_H + +/* This is where basename() is declared. */ +#include + +#ifndef __GNU_LIBRARY__ +/* When not using the GNU libc we use the basename implementation we + provide here. */ +extern char *gnu_basename PARAMS ((const char *)); +#define basename(Arg) gnu_basename (Arg) +#endif + +#endif /* _BASENAME_H */ diff --git a/lib/system.h b/lib/system.h index 20bae4a10..5d822e91a 100644 --- a/lib/system.h +++ b/lib/system.h @@ -154,13 +154,6 @@ extern char *concatenated_pathname PARAMS ((const char *directory, const char *filename, const char *suffix)); -/* When not using the GNU libc we use the basename implementation we - provide here. */ -#ifndef __GNU_LIBRARY__ -extern char *gnu_basename PARAMS ((const char *)); -# define basename(Arg) gnu_basename (Arg) -#endif - #include /* For systems that distinguish between text and binary I/O. diff --git a/src/ChangeLog b/src/ChangeLog index ffa5cead9..4e8bcad25 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,25 @@ +2001-09-17 Bruno Haible + + * gettext.c: Include basename.h. + * ngettext.c: Likewise. + * msgattrib.c: Likewise. + * msgcat.c: Likewise. + * msgcmp.c: Likewise. + * msgcomm.c: Likewise. + * msgconv.c: Likewise. + * msgen.c: Likewise. + * msgexec.c: Likewise. + * msgfmt.c: Likewise. + * msggrep.c: Likewise. + * msgl-cat.c: Likewise. + * msgl-charset.c: Likewise. + * msgl-iconv.c: Likewise. + * msgmerge.c: Likewise. + * msgunfmt.c: Likewise. + * msguniq.c: Likewise. + * xgettext.c: Likewise. + * po-charset.c: Include and basename.h. + 2001-09-16 Bruno Haible * x-c.c (phase4_getc): Rename local variable 'state' to diff --git a/src/gettext.c b/src/gettext.c index f89725ce2..dc365eaeb 100644 --- a/src/gettext.c +++ b/src/gettext.c @@ -27,6 +27,7 @@ #include #include "error.h" +#include "basename.h" #include "xmalloc.h" #include "system.h" diff --git a/src/msgattrib.c b/src/msgattrib.c index c823ced98..a4e2a26f8 100644 --- a/src/msgattrib.c +++ b/src/msgattrib.c @@ -30,6 +30,7 @@ #include "dir-list.h" #include "error.h" #include "progname.h" +#include "basename.h" #include "message.h" #include "read-po.h" #include "write-po.h" diff --git a/src/msgcat.c b/src/msgcat.c index c1d7a1629..d92ae9b10 100644 --- a/src/msgcat.c +++ b/src/msgcat.c @@ -32,6 +32,7 @@ #include "file-list.h" #include "error.h" #include "progname.h" +#include "basename.h" #include "message.h" #include "read-po.h" #include "write-po.h" diff --git a/src/msgcmp.c b/src/msgcmp.c index 390786b7b..275c366b8 100644 --- a/src/msgcmp.c +++ b/src/msgcmp.c @@ -29,6 +29,7 @@ #include "dir-list.h" #include "error.h" #include "progname.h" +#include "basename.h" #include "message.h" #include "system.h" #include "libgettext.h" diff --git a/src/msgcomm.c b/src/msgcomm.c index 9382f1538..91fbef8e3 100644 --- a/src/msgcomm.c +++ b/src/msgcomm.c @@ -32,6 +32,7 @@ #include "file-list.h" #include "error.h" #include "progname.h" +#include "basename.h" #include "message.h" #include "read-po.h" #include "write-po.h" diff --git a/src/msgconv.c b/src/msgconv.c index 4ec75162f..1c8dc87c8 100644 --- a/src/msgconv.c +++ b/src/msgconv.c @@ -29,6 +29,7 @@ #include "dir-list.h" #include "error.h" #include "progname.h" +#include "basename.h" #include "message.h" #include "read-po.h" #include "write-po.h" diff --git a/src/msgen.c b/src/msgen.c index 1dc7f0a94..05df1cfca 100644 --- a/src/msgen.c +++ b/src/msgen.c @@ -29,6 +29,7 @@ #include "dir-list.h" #include "error.h" #include "progname.h" +#include "basename.h" #include "message.h" #include "read-po.h" #include "write-po.h" diff --git a/src/msgexec.c b/src/msgexec.c index 86f476fce..1b54f5514 100644 --- a/src/msgexec.c +++ b/src/msgexec.c @@ -39,6 +39,7 @@ #include "dir-list.h" #include "error.h" #include "progname.h" +#include "basename.h" #include "message.h" #include "read-po.h" #include "write-po.h" diff --git a/src/msgfmt.c b/src/msgfmt.c index 3e2da47b0..8ec790494 100644 --- a/src/msgfmt.c +++ b/src/msgfmt.c @@ -31,6 +31,7 @@ #include "error.h" #include "hash.h" #include "progname.h" +#include "basename.h" #include "xerror.h" #include "getline.h" #include "format.h" diff --git a/src/msggrep.c b/src/msggrep.c index 85688ea3a..de1c07b26 100644 --- a/src/msggrep.c +++ b/src/msggrep.c @@ -37,6 +37,7 @@ #include "dir-list.h" #include "error.h" #include "progname.h" +#include "basename.h" #include "message.h" #include "read-po.h" #include "write-po.h" diff --git a/src/msgl-cat.c b/src/msgl-cat.c index a8809a5b1..44622e834 100644 --- a/src/msgl-cat.c +++ b/src/msgl-cat.c @@ -36,6 +36,7 @@ #include "msgl-iconv.h" #include "xmalloc.h" #include "strstr.h" +#include "basename.h" #include "system.h" #include "libgettext.h" diff --git a/src/msgl-charset.c b/src/msgl-charset.c index b803bbbbb..6f800bea9 100644 --- a/src/msgl-charset.c +++ b/src/msgl-charset.c @@ -30,6 +30,7 @@ #include "po-charset.h" #include "error.h" #include "progname.h" +#include "basename.h" #include "xerror.h" #include "message.h" #include "strstr.h" diff --git a/src/msgl-iconv.c b/src/msgl-iconv.c index b5fe4087f..3538cc786 100644 --- a/src/msgl-iconv.c +++ b/src/msgl-iconv.c @@ -34,6 +34,7 @@ #include "error.h" #include "progname.h" +#include "basename.h" #include "message.h" #include "po-charset.h" #include "msgl-ascii.h" diff --git a/src/msgmerge.c b/src/msgmerge.c index da5003ac7..ca9f547b8 100644 --- a/src/msgmerge.c +++ b/src/msgmerge.c @@ -29,6 +29,7 @@ #include "dir-list.h" #include "error.h" #include "progname.h" +#include "basename.h" #include "message.h" #include "read-po.h" #include "write-po.h" diff --git a/src/msgunfmt.c b/src/msgunfmt.c index 69de4318b..7b500676e 100644 --- a/src/msgunfmt.c +++ b/src/msgunfmt.c @@ -28,6 +28,7 @@ #include "error.h" #include "progname.h" +#include "basename.h" #include "system.h" #include "message.h" #include "msgunfmt.h" diff --git a/src/msguniq.c b/src/msguniq.c index ebaae5f27..fe0c77ef2 100644 --- a/src/msguniq.c +++ b/src/msguniq.c @@ -31,6 +31,7 @@ #include "str-list.h" #include "error.h" #include "progname.h" +#include "basename.h" #include "message.h" #include "read-po.h" #include "write-po.h" diff --git a/src/ngettext.c b/src/ngettext.c index 9f3bc4ba2..210de0d76 100644 --- a/src/ngettext.c +++ b/src/ngettext.c @@ -27,6 +27,7 @@ #include #include "error.h" +#include "basename.h" #include "xmalloc.h" #include "system.h" diff --git a/src/po-charset.c b/src/po-charset.c index d01da1934..9a00be0e8 100644 --- a/src/po-charset.c +++ b/src/po-charset.c @@ -24,8 +24,11 @@ /* Specification. */ #include "po-charset.h" +#include + #include "error.h" #include "xerror.h" +#include "basename.h" #include "strstr.h" #include "system.h" #include "libgettext.h" diff --git a/src/xgettext.c b/src/xgettext.c index 1e1051a19..0f9fc1200 100644 --- a/src/xgettext.c +++ b/src/xgettext.c @@ -41,6 +41,7 @@ #include "file-list.h" #include "error.h" #include "progname.h" +#include "basename.h" #include "xerror.h" #include "getline.h" #include "xmalloc.h" diff --git a/tests/ChangeLog b/tests/ChangeLog index fdd0d7dbe..d11d772b1 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,7 @@ +2001-09-17 Bruno Haible + + * tstngettext.c: Include basename.h. + 2001-09-22 Bruno Haible * Makefile.am (TESTS): Add xgettext-12, xgettext-13, xgettext-14. diff --git a/tests/tstngettext.c b/tests/tstngettext.c index aa54662a5..526b346e7 100644 --- a/tests/tstngettext.c +++ b/tests/tstngettext.c @@ -26,6 +26,7 @@ #include #include "error.h" +#include "basename.h" #include "system.h" #define HAVE_SETLOCALE 1