Update after gnulib changed.

* gnulib-local/lib/regex_internal.h.diff: Update.
* gnulib-local/lib/unistd.in.h.diff: Update.
* gettext-runtime/intl/filename.h: New file, from gnulib.
* gettext-runtime/intl/dcigettext.c (ISSLASH, HAS_DEVICE, IS_ABSOLUTE_PATH,
IS_PATH_WITH_DIR): Remove macros. Instead, include filename.h.
(IS_ABSOLUTE_FILE_NAME, IS_RELATIVE_FILE_NAME, IS_FILE_NAME_WITH_DIR): New
macros.
(DCIGETTEXT): Use IS_RELATIVE_FILE_NAME, IS_FILE_NAME_WITH_DIR.
* gettext-runtime/intl/l10nflist.c (ISSLASH, HAS_DEVICE, IS_ABSOLUTE_PATH):
Remove macros. Instead, include filename.h.
(IS_ABSOLUTE_FILE_NAME, IS_RELATIVE_FILE_NAME): New macros.
(_nl_make_l10nflist): Use IS_RELATIVE_FILE_NAME.
* gettext-runtime/intl/Makefile.am (EXTRA_DIST): Add filename.h.
(l10nflist.lo, dcigettext.lo): Depend on it.
* Makefile.am (distcheck-hook): Check also gettext-runtime/intl/filename.h.
* gettext-runtime/intl/lock.c: Update from gnulib.
* gettext-runtime/intl/lock.h: Likewise.
* gettext-runtime/intl/relocatable.c: Likewise.
* gettext-tools/src/locating-rule.c (locating_rule_list_locate): Use
IS_RELATIVE_FILE_NAME instead of IS_ABSOLUTE_PATH.
* gettext-tools/src/open-catalog.c (try_open_catalog_file): Likewise.
* gettext-tools/src/xgettext.c (main, xgettext_open): Likewise.
* libtextstyle/lib/color.c (style_file_lookup): Use IS_FILE_NAME_WITH_DIR
instead of IS_PATH_WITH_DIR.
This commit is contained in:
Bruno Haible 2020-03-28 20:03:44 +01:00
parent 1213bd0044
commit 77c09d31a1
16 changed files with 247 additions and 108 deletions

6
.gitignore vendored
View File

@ -148,6 +148,8 @@
/gettext-tools/libgettextpo/intprops.h
/gettext-tools/libgettextpo/inttypes.in.h
/gettext-tools/libgettextpo/itold.c
/gettext-tools/libgettextpo/lc-charset-dispatch.c
/gettext-tools/libgettextpo/lc-charset-dispatch.h
/gettext-tools/libgettextpo/libunistring.valgrind
/gettext-tools/libgettextpo/limits.in.h
/gettext-tools/libgettextpo/localcharset.c
@ -159,9 +161,13 @@
/gettext-tools/libgettextpo/markup.c
/gettext-tools/libgettextpo/markup.h
/gettext-tools/libgettextpo/mbrtowc.c
/gettext-tools/libgettextpo/mbrtowc-impl.h
/gettext-tools/libgettextpo/mbrtowc-impl-utf8.h
/gettext-tools/libgettextpo/mbsinit.c
/gettext-tools/libgettextpo/mbswidth.c
/gettext-tools/libgettextpo/mbswidth.h
/gettext-tools/libgettextpo/mbtowc-lock.c
/gettext-tools/libgettextpo/mbtowc-lock.h
/gettext-tools/libgettextpo/memchr.c
/gettext-tools/libgettextpo/memchr.valgrind
/gettext-tools/libgettextpo/minmax.h

View File

@ -1,5 +1,5 @@
## Makefile for the toplevel directory of GNU gettext
## Copyright (C) 1995-2019 Free Software Foundation, Inc.
## Copyright (C) 1995-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
@ -86,6 +86,7 @@ distcheck-hook:
cmp -s $(srcdir)/gettext-runtime/m4/xsize.m4 $(srcdir)/gettext-tools/gnulib-m4/xsize.m4
cmp -s $(srcdir)/gettext-runtime/libasprintf/gnulib-m4/intmax_t.m4 $(srcdir)/gettext-tools/gnulib-m4/intmax_t.m4
test "`sed 1,16d $(srcdir)/gettext-runtime/intl/arg-nonnull.h | md5sum`" = "`sed 1,16d $(srcdir)/gettext-tools/gnulib-lib/arg-nonnull.h | md5sum`"
test "`sed 1,15d $(srcdir)/gettext-runtime/intl/filename.h | md5sum`" = "`sed 1,15d $(srcdir)/gettext-tools/gnulib-lib/filename.h | md5sum`"
test "`sed 1,16d $(srcdir)/gettext-runtime/intl/flexmember.h | md5sum`" = "`sed 1,19d $(srcdir)/gettext-tools/gnulib-lib/flexmember.h | md5sum`"
test "`sed 1,16d $(srcdir)/gettext-runtime/intl/localcharset.h | md5sum`" = "`sed 1,16d $(srcdir)/gettext-tools/gnulib-lib/localcharset.h | md5sum`"
test "`sed 1,16d $(srcdir)/gettext-runtime/intl/localcharset.c | md5sum`" = "`sed 1,16d $(srcdir)/gettext-tools/gnulib-lib/localcharset.c | md5sum`"

View File

@ -1,6 +1,6 @@
## Makefile for the gettext-runtime/intl and gettext-tools/intl subdirectories
## of GNU gettext.
## Copyright (C) 1995-1998, 2000-2007, 2009-2019 Free Software Foundation, Inc.
## Copyright (C) 1995-1998, 2000-2007, 2009-2020 Free Software Foundation, Inc.
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU Lesser General Public License as published by
@ -93,6 +93,7 @@ EXTRA_DIST += \
lock.h windows-mutex.h windows-rwlock.h windows-recmutex.h windows-once.h windows-initguard.h \
relocatable.h \
arg-nonnull.h \
filename.h \
flexmember.h \
localename-table.in.h \
setlocale_null.h \
@ -323,9 +324,9 @@ hash-string.lo: ../config.h $(srcdir)/hash-string.h
loadmsgcat.lo: ../config.h $(srcdir)/gettextP.h libgnuintl.h $(srcdir)/gmo.h $(srcdir)/loadinfo.h $(srcdir)/lock.h $(srcdir)/windows-mutex.h $(srcdir)/windows-rwlock.h $(srcdir)/windows-recmutex.h $(srcdir)/windows-once.h $(srcdir)/windows-initguard.h $(srcdir)/hash-string.h $(srcdir)/plural-exp.h
localealias.lo: ../config.h $(srcdir)/gettextP.h libgnuintl.h $(srcdir)/gmo.h $(srcdir)/loadinfo.h $(srcdir)/lock.h $(srcdir)/windows-mutex.h $(srcdir)/windows-rwlock.h $(srcdir)/windows-recmutex.h $(srcdir)/windows-once.h $(srcdir)/windows-initguard.h $(srcdir)/relocatable.h
textdomain.lo: ../config.h $(srcdir)/gettextP.h libgnuintl.h $(srcdir)/gmo.h $(srcdir)/loadinfo.h $(srcdir)/lock.h $(srcdir)/windows-mutex.h $(srcdir)/windows-rwlock.h $(srcdir)/windows-recmutex.h $(srcdir)/windows-once.h $(srcdir)/windows-initguard.h
l10nflist.lo: ../config.h $(srcdir)/loadinfo.h
l10nflist.lo: ../config.h $(srcdir)/loadinfo.h $(srcdir)/filename.h
explodename.lo: ../config.h $(srcdir)/loadinfo.h
dcigettext.lo: ../config.h $(srcdir)/gettextP.h libgnuintl.h $(srcdir)/gmo.h $(srcdir)/loadinfo.h $(srcdir)/lock.h $(srcdir)/windows-mutex.h $(srcdir)/windows-rwlock.h $(srcdir)/windows-recmutex.h $(srcdir)/windows-once.h $(srcdir)/windows-initguard.h $(srcdir)/localcharset.h $(srcdir)/plural-exp.h $(srcdir)/hash-string.h $(srcdir)/tsearch.h $(srcdir)/tsearch.c $(srcdir)/eval-plural.h
dcigettext.lo: ../config.h $(srcdir)/gettextP.h libgnuintl.h $(srcdir)/gmo.h $(srcdir)/loadinfo.h $(srcdir)/lock.h $(srcdir)/windows-mutex.h $(srcdir)/windows-rwlock.h $(srcdir)/windows-recmutex.h $(srcdir)/windows-once.h $(srcdir)/windows-initguard.h $(srcdir)/localcharset.h $(srcdir)/plural-exp.h $(srcdir)/hash-string.h $(srcdir)/tsearch.h $(srcdir)/tsearch.c $(srcdir)/eval-plural.h $(srcdir)/filename.h
dcngettext.lo: ../config.h $(srcdir)/gettextP.h libgnuintl.h $(srcdir)/gmo.h $(srcdir)/loadinfo.h $(srcdir)/lock.h $(srcdir)/windows-mutex.h $(srcdir)/windows-rwlock.h $(srcdir)/windows-recmutex.h $(srcdir)/windows-once.h $(srcdir)/windows-initguard.h
dngettext.lo: ../config.h $(srcdir)/gettextP.h libgnuintl.h $(srcdir)/gmo.h $(srcdir)/loadinfo.h $(srcdir)/lock.h $(srcdir)/windows-mutex.h $(srcdir)/windows-rwlock.h $(srcdir)/windows-recmutex.h $(srcdir)/windows-once.h $(srcdir)/windows-initguard.h
ngettext.lo: ../config.h $(srcdir)/gettextP.h libgnuintl.h $(srcdir)/gmo.h $(srcdir)/loadinfo.h $(srcdir)/lock.h $(srcdir)/windows-mutex.h $(srcdir)/windows-rwlock.h $(srcdir)/windows-recmutex.h $(srcdir)/windows-once.h $(srcdir)/windows-initguard.h

View File

@ -1,5 +1,5 @@
/* Implementation of the internal dcigettext function.
Copyright (C) 1995-2019 Free Software Foundation, Inc.
Copyright (C) 1995-2020 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
@ -203,26 +203,12 @@ static void *mempcpy (void *dest, const void *src, size_t n);
# define PATH_MAX _POSIX_PATH_MAX
#endif
/* Pathname support.
ISSLASH(C) tests whether C is a directory separator character.
IS_ABSOLUTE_PATH(P) tests whether P is an absolute path. If it is not,
it may be concatenated to a directory pathname.
IS_PATH_WITH_DIR(P) tests whether P contains a directory specification.
*/
#if defined _WIN32 || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
/* Win32, Cygwin, OS/2, DOS */
# define ISSLASH(C) ((C) == '/' || (C) == '\\')
# define HAS_DEVICE(P) \
((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
&& (P)[1] == ':')
# define IS_ABSOLUTE_PATH(P) (ISSLASH ((P)[0]) || HAS_DEVICE (P))
# define IS_PATH_WITH_DIR(P) \
(strchr (P, '/') != NULL || strchr (P, '\\') != NULL || HAS_DEVICE (P))
#ifdef _LIBC
# define IS_ABSOLUTE_FILE_NAME(P) ((P)[0] == '/')
# define IS_RELATIVE_FILE_NAME(P) (! IS_ABSOLUTE_FILE_NAME (P))
# define IS_FILE_NAME_WITH_DIR(P) (strchr ((P), '/') != NULL)
#else
/* Unix */
# define ISSLASH(C) ((C) == '/')
# define IS_ABSOLUTE_PATH(P) ISSLASH ((P)[0])
# define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL)
# include "filename.h"
#endif
/* Whether to support different locales in different threads. */
@ -620,7 +606,7 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
{
dirname = binding->dirname;
#endif
if (!IS_ABSOLUTE_PATH (dirname))
if (IS_RELATIVE_FILE_NAME (dirname))
{
/* We have a relative path. Make it absolute now. */
size_t dirname_len = strlen (dirname) + 1;
@ -706,7 +692,7 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
/* When this is a SUID binary we must not allow accessing files
outside the dedicated directories. */
if (ENABLE_SECURE && IS_PATH_WITH_DIR (single_locale))
if (ENABLE_SECURE && IS_FILE_NAME_WITH_DIR (single_locale))
/* Ingore this entry. */
continue;
}

View File

@ -0,0 +1,110 @@
/* Basic filename support macros.
Copyright (C) 2001-2004, 2007-2020 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* From Paul Eggert and Jim Meyering. */
#ifndef _FILENAME_H
#define _FILENAME_H
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Filename support.
ISSLASH(C) tests whether C is a directory separator
character.
HAS_DEVICE(Filename) tests whether Filename contains a device
specification.
FILE_SYSTEM_PREFIX_LEN(Filename) length of the device specification
at the beginning of Filename,
index of the part consisting of
alternating components and slashes.
FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
1 when a non-empty device specification
can be followed by an empty or relative
part,
0 when a non-empty device specification
must be followed by a slash,
0 when device specification don't exist.
IS_ABSOLUTE_FILE_NAME(Filename)
tests whether Filename is independent of
any notion of "current directory".
IS_RELATIVE_FILE_NAME(Filename)
tests whether Filename may be concatenated
to a directory filename.
Note: On native Windows, OS/2, DOS, "c:" is neither an absolute nor a
relative file name!
IS_FILE_NAME_WITH_DIR(Filename) tests whether Filename contains a device
or directory specification.
*/
#if defined _WIN32 || defined __CYGWIN__ \
|| defined __EMX__ || defined __MSDOS__ || defined __DJGPP__
/* Native Windows, Cygwin, OS/2, DOS */
# define ISSLASH(C) ((C) == '/' || (C) == '\\')
/* Internal macro: Tests whether a character is a drive letter. */
# define _IS_DRIVE_LETTER(C) \
(((C) >= 'A' && (C) <= 'Z') || ((C) >= 'a' && (C) <= 'z'))
/* Help the compiler optimizing it. This assumes ASCII. */
# undef _IS_DRIVE_LETTER
# define _IS_DRIVE_LETTER(C) \
(((unsigned int) (C) | ('a' - 'A')) - 'a' <= 'z' - 'a')
# define HAS_DEVICE(Filename) \
(_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':')
# define FILE_SYSTEM_PREFIX_LEN(Filename) (HAS_DEVICE (Filename) ? 2 : 0)
# ifdef __CYGWIN__
# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0
# else
/* On native Windows, OS/2, DOS, the system has the notion of a
"current directory" on each drive. */
# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 1
# endif
# if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
# define IS_ABSOLUTE_FILE_NAME(Filename) \
ISSLASH ((Filename)[FILE_SYSTEM_PREFIX_LEN (Filename)])
# else
# define IS_ABSOLUTE_FILE_NAME(Filename) \
(ISSLASH ((Filename)[0]) || HAS_DEVICE (Filename))
# endif
# define IS_RELATIVE_FILE_NAME(Filename) \
(! (ISSLASH ((Filename)[0]) || HAS_DEVICE (Filename)))
# define IS_FILE_NAME_WITH_DIR(Filename) \
(strchr ((Filename), '/') != NULL || strchr ((Filename), '\\') != NULL \
|| HAS_DEVICE (Filename))
#else
/* Unix */
# define ISSLASH(C) ((C) == '/')
# define HAS_DEVICE(Filename) ((void) (Filename), 0)
# define FILE_SYSTEM_PREFIX_LEN(Filename) ((void) (Filename), 0)
# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0
# define IS_ABSOLUTE_FILE_NAME(Filename) ISSLASH ((Filename)[0])
# define IS_RELATIVE_FILE_NAME(Filename) (! ISSLASH ((Filename)[0]))
# define IS_FILE_NAME_WITH_DIR(Filename) (strchr ((Filename), '/') != NULL)
#endif
/* Deprecated macros. For backward compatibility with old users of the
'filename' module. */
#define IS_ABSOLUTE_PATH IS_ABSOLUTE_FILE_NAME
#define IS_PATH_WITH_DIR IS_FILE_NAME_WITH_DIR
#ifdef __cplusplus
}
#endif
#endif /* _FILENAME_H */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1995-2016, 2018 Free Software Foundation, Inc.
/* Copyright (C) 1995-2016, 2018, 2020 Free Software Foundation, Inc.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
This program is free software: you can redistribute it and/or modify
@ -60,22 +60,11 @@ static char *stpcpy (char *dest, const char *src);
# endif
#endif
/* Pathname support.
ISSLASH(C) tests whether C is a directory separator character.
IS_ABSOLUTE_PATH(P) tests whether P is an absolute path. If it is not,
it may be concatenated to a directory pathname.
*/
#if defined _WIN32 || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
/* Win32, Cygwin, OS/2, DOS */
# define ISSLASH(C) ((C) == '/' || (C) == '\\')
# define HAS_DEVICE(P) \
((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
&& (P)[1] == ':')
# define IS_ABSOLUTE_PATH(P) (ISSLASH ((P)[0]) || HAS_DEVICE (P))
#ifdef _LIBC
# define IS_ABSOLUTE_FILE_NAME(P) ((P)[0] == '/')
# define IS_RELATIVE_FILE_NAME(P) (! IS_ABSOLUTE_FILE_NAME (P))
#else
/* Unix */
# define ISSLASH(C) ((C) == '/')
# define IS_ABSOLUTE_PATH(P) ISSLASH ((P)[0])
# include "filename.h"
#endif
/* Define function which are usually not available. */
@ -183,7 +172,7 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
/* If LANGUAGE contains an absolute directory specification, we ignore
DIRLIST. */
if (IS_ABSOLUTE_PATH (language))
if (!IS_RELATIVE_FILE_NAME (language))
dirlist_len = 0;
/* Allocate room for the full file name. */

View File

@ -1,5 +1,5 @@
/* Locking in multithreaded situations.
Copyright (C) 2005-2008, 2012, 2017, 2019 Free Software Foundation, Inc.
Copyright (C) 2005-2008, 2012, 2017, 2019-2020 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
@ -718,6 +718,26 @@ glthread_once_singlethreaded (pthread_once_t *once_control)
return 0;
}
# if !(PTHREAD_IN_USE_DETECTION_HARD || USE_POSIX_THREADS_WEAK)
int
glthread_once_multithreaded (pthread_once_t *once_control,
void (*init_function) (void))
{
int err = pthread_once (once_control, init_function);
if (err == ENOSYS)
{
/* This happens on FreeBSD 11: The pthread_once function in libc returns
ENOSYS. */
if (glthread_once_singlethreaded (once_control))
init_function ();
return 0;
}
return err;
}
# endif
#endif
/* ========================================================================= */

View File

@ -1,5 +1,5 @@
/* Locking in multithreaded situations.
Copyright (C) 2005-2008, 2017-2019 Free Software Foundation, Inc.
Copyright (C) 2005-2008, 2017-2020 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
@ -505,10 +505,19 @@ extern int glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *l
typedef pthread_once_t gl_once_t;
# define gl_once_define(STORAGECLASS, NAME) \
STORAGECLASS pthread_once_t NAME = PTHREAD_ONCE_INIT;
# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
(pthread_in_use () \
? pthread_once (ONCE_CONTROL, INITFUNCTION) \
: (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0))
# if PTHREAD_IN_USE_DETECTION_HARD || USE_POSIX_THREADS_WEAK
# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
(pthread_in_use () \
? pthread_once (ONCE_CONTROL, INITFUNCTION) \
: (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0))
# else
# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
(pthread_in_use () \
? glthread_once_multithreaded (ONCE_CONTROL, INITFUNCTION) \
: (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0))
extern int glthread_once_multithreaded (pthread_once_t *once_control,
void (*init_function) (void));
# endif
extern int glthread_once_singlethreaded (pthread_once_t *once_control);
# ifdef __cplusplus

View File

@ -74,8 +74,8 @@
#define true 1
/* Pathname support.
ISSLASH(C) tests whether C is a directory separator character.
IS_PATH_WITH_DIR(P) tests whether P contains a directory specification.
ISSLASH(C) tests whether C is a directory separator character.
IS_FILE_NAME_WITH_DIR(P) tests whether P contains a directory specification.
*/
#if (defined _WIN32 && !defined __CYGWIN__) || defined __EMX__ || defined __DJGPP__
/* Native Windows, OS/2, DOS */
@ -83,13 +83,13 @@
# define HAS_DEVICE(P) \
((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
&& (P)[1] == ':')
# define IS_PATH_WITH_DIR(P) \
# define IS_FILE_NAME_WITH_DIR(P) \
(strchr (P, '/') != NULL || strchr (P, '\\') != NULL || HAS_DEVICE (P))
# define FILE_SYSTEM_PREFIX_LEN(P) (HAS_DEVICE (P) ? 2 : 0)
#else
/* Unix */
# define ISSLASH(C) ((C) == '/')
# define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL)
# define IS_FILE_NAME_WITH_DIR(P) (strchr (P, '/') != NULL)
# define FILE_SYSTEM_PREFIX_LEN(P) 0
#endif
@ -333,7 +333,7 @@ DllMain (HINSTANCE module_handle, DWORD event, LPVOID reserved)
/* Shouldn't happen. */
return FALSE;
if (!IS_PATH_WITH_DIR (location))
if (!IS_FILE_NAME_WITH_DIR (location))
/* Shouldn't happen. */
return FALSE;

View File

@ -1,5 +1,5 @@
/* XML resource locating rules
Copyright (C) 2015, 2019 Free Software Foundation, Inc.
Copyright (C) 2015, 2019-2020 Free Software Foundation, Inc.
This file was written by Daiki Ueno <ueno@gnu.org>, 2015.
@ -194,18 +194,11 @@ locating_rule_list_locate (struct locating_rule_list_ty *rules,
const char *filename,
const char *name)
{
const char *target = NULL;
size_t i;
for (i = 0; i < rules->nitems; i++)
{
if (IS_ABSOLUTE_PATH (filename))
{
target = locating_rule_match (&rules->items[i], filename, name);
if (target != NULL)
return target;
}
else
if (IS_RELATIVE_FILE_NAME (filename))
{
int j;
@ -213,6 +206,7 @@ locating_rule_list_locate (struct locating_rule_list_ty *rules,
{
const char *dir = dir_list_nth (j);
char *new_filename;
const char *target;
if (dir == NULL)
break;
@ -225,6 +219,14 @@ locating_rule_list_locate (struct locating_rule_list_ty *rules,
return target;
}
}
else
{
const char *target =
locating_rule_match (&rules->items[i], filename, name);
if (target != NULL)
return target;
}
}
return NULL;

View File

@ -1,5 +1,5 @@
/* open-po - search for .po file along search path list and open for reading
Copyright (C) 1995-1996, 2000-2003, 2005-2009 Free Software Foundation, Inc.
Copyright (C) 1995-1996, 2000-2003, 2005-2009, 2020 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, April 1995.
This program is free software: you can redistribute it and/or modify
@ -57,10 +57,32 @@ try_open_catalog_file (const char *input_name, char **real_file_name_p)
return stdin;
}
/* We have a real name for the input file. If the name is absolute,
try the various extensions, but ignore the directory search list. */
if (IS_ABSOLUTE_PATH (input_name))
/* We have a real name for the input file. */
if (IS_RELATIVE_FILE_NAME (input_name))
{
/* For relative file names, look through the directory search list,
trying the various extensions. If no directory search list is
specified, the current directory is used. */
for (j = 0; (dir = dir_list_nth (j)) != NULL; ++j)
for (k = 0; k < SIZEOF (extension); ++k)
{
file_name = xconcatenated_filename (dir, input_name, extension[k]);
ret_val = fopen (file_name, "r");
if (ret_val != NULL || errno != ENOENT)
{
/* We found the file. */
*real_file_name_p = file_name;
return ret_val;
}
free (file_name);
}
}
else
{
/* The name is not relative. Try the various extensions, but ignore the
directory search list. */
for (k = 0; k < SIZEOF (extension); ++k)
{
file_name = xconcatenated_filename ("", input_name, extension[k]);
@ -76,26 +98,6 @@ try_open_catalog_file (const char *input_name, char **real_file_name_p)
free (file_name);
}
}
else
{
/* For relative file names, look through the directory search list,
trying the various extensions. If no directory search list is
specified, the current directory is used. */
for (j = 0; (dir = dir_list_nth (j)) != NULL; ++j)
for (k = 0; k < SIZEOF (extension); ++k)
{
file_name = xconcatenated_filename (dir, input_name, extension[k]);
ret_val = fopen (file_name, "r");
if (ret_val != NULL || errno != ENOENT)
{
*real_file_name_p = file_name;
return ret_val;
}
free (file_name);
}
}
/* File does not exist. */
*real_file_name_p = xstrdup (input_name);

View File

@ -1,5 +1,5 @@
/* Extracts strings from C source file to Uniforum style .po file.
Copyright (C) 1995-1998, 2000-2016, 2018-2019 Free Software Foundation, Inc.
Copyright (C) 1995-1998, 2000-2016, 2018-2020 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, April 1995.
This program is free software: you can redistribute it and/or modify
@ -746,11 +746,11 @@ xgettext cannot work without keywords to look for"));
the special name "-" we write to stdout. */
if (output_file)
{
if (IS_ABSOLUTE_PATH (output_file) || strcmp (output_file, "-") == 0)
file_name = xstrdup (output_file);
else
if (IS_RELATIVE_FILE_NAME (output_file) && strcmp (output_file, "-") != 0)
/* Please do NOT add a .po suffix! */
file_name = xconcatenated_filename (output_dir, output_file, NULL);
else
file_name = xstrdup (output_file);
}
else if (strcmp (default_domain, "-") == 0)
file_name = "-";
@ -1707,16 +1707,7 @@ xgettext_open (const char *fn,
logical_file_name = xstrdup (new_name);
fp = stdin;
}
else if (IS_ABSOLUTE_PATH (fn))
{
new_name = xstrdup (fn);
fp = fopen (fn, "r");
if (fp == NULL)
error (EXIT_FAILURE, errno,
_("error while opening \"%s\" for reading"), fn);
logical_file_name = xstrdup (new_name);
}
else
else if (IS_RELATIVE_FILE_NAME (fn))
{
int j;
@ -1747,6 +1738,15 @@ xgettext_open (const char *fn,
file name which was searched for. */
logical_file_name = xstrdup (fn);
}
else
{
new_name = xstrdup (fn);
fp = fopen (fn, "r");
if (fp == NULL)
error (EXIT_FAILURE, errno,
_("error while opening \"%s\" for reading"), fn);
logical_file_name = xstrdup (new_name);
}
*logical_file_name_p = logical_file_name;
*real_file_name_p = new_name;

View File

@ -1,7 +1,7 @@
*** lib/regex_internal.h.orig Mon May 24 12:36:55 2010
--- lib/regex_internal.h Mon May 24 12:35:46 2010
***************
*** 476,482 ****
*** 468,474 ****
# define MAX(a,b) ((a) < (b) ? (b) : (a))
#endif
@ -9,7 +9,7 @@
#define re_realloc(p,t,n) ((t *) realloc (p, (n) * sizeof (t)))
#define re_free(p) free (p)
--- 476,482 ----
--- 468,474 ----
# define MAX(a,b) ((a) < (b) ? (b) : (a))
#endif

View File

@ -1,14 +1,15 @@
--- unistd.in.h 2017-05-15 19:05:30.449063823 +0200
+++ unistd.in.h.new 2017-05-15 19:14:39.145268786 +0200
@@ -136,6 +136,10 @@
@@ -141,7 +141,11 @@
/* Get getopt(), optarg, optind, opterr, optopt. */
-#if @GNULIB_UNISTD_H_GETOPT@ && !defined _GL_SYSTEM_GETOPT
-#if @GNULIB_GETOPT_POSIX@ && @GNULIB_UNISTD_H_GETOPT@ && !defined _GL_SYSTEM_GETOPT
+/* Also, don't include <getopt.h> inside libgettextpo, because we use
+ the getopt module only in gettext-tools/gnulib-lib/, not in
+ gettext-tools/libgettextpo/, but there is only a single
+ GNULIB_UNISTD_H_GETOPT variable for both. */
+#if @GNULIB_UNISTD_H_GETOPT@ && !defined GTPO_CONFIG_H && !defined _GL_SYSTEM_GETOPT
+#if @GNULIB_GETOPT_POSIX@ && @GNULIB_UNISTD_H_GETOPT@ && !defined GTPO_CONFIG_H && !defined _GL_SYSTEM_GETOPT
# include <getopt-cdefs.h>
# include <getopt-pfx-core.h>
#endif

View File

@ -58,6 +58,7 @@
/lib/fpucw.h
/lib/frexp.c
/lib/frexpl.c
/lib/fstat.c
/lib/fsync.c
/lib/full-write.c
/lib/full-write.h
@ -106,6 +107,8 @@
/lib/localtime-buffer.h
/lib/log10.c
/lib/malloc.c
/lib/malloca.c
/lib/malloca.h
/lib/math.c
/lib/math.in.h
/lib/memchr.c
@ -124,6 +127,7 @@
/lib/obstack.h
/lib/ostream.oo.c
/lib/ostream.oo.h
/lib/pathmax.h
/lib/printf-args.c
/lib/printf-args.h
/lib/printf-frexp.c
@ -151,6 +155,11 @@
/lib/snprintf.c
/lib/sockets.c
/lib/sockets.h
/lib/stat.c
/lib/stat-time.c
/lib/stat-time.h
/lib/stat-w32.c
/lib/stat-w32.h
/lib/stdalign.in.h
/lib/stdarg.in.h
/lib/stdbool.in.h
@ -169,6 +178,7 @@
/lib/sys-limits.h
/lib/sys_socket.c
/lib/sys_socket.in.h
/lib/sys_stat.in.h
/lib/sys_time.in.h
/lib/sys_types.in.h
/lib/sys_uio.in.h
@ -494,6 +504,8 @@ core
/lib/string.h-t
/lib/sys/socket.h
/lib/sys/socket.h-t
/lib/sys/stat.h
/lib/sys/stat.h-t
/lib/sys/time.h
/lib/sys/time.h-t
/lib/sys/types.h

View File

@ -1,5 +1,5 @@
/* Color and styling handling.
Copyright (C) 2006-2008, 2019 Free Software Foundation, Inc.
Copyright (C) 2006-2008, 2019-2020 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2006.
This program is free software: you can redistribute it and/or modify
@ -388,7 +388,7 @@ print_color_test ()
static const char *
style_file_lookup (const char *file_name, const char *stylesdir_after_install)
{
if (!IS_PATH_WITH_DIR (file_name))
if (!IS_FILE_NAME_WITH_DIR (file_name))
{
/* It's a file name without a directory specification.
If it does not exist in the current directory... */