diff options
-rw-r--r-- | ChangeLog | 35 | ||||
-rw-r--r-- | MakeTAGS | 15 | ||||
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | configure.in | 6 | ||||
-rw-r--r-- | intl/finddomain.c | 135 | ||||
-rw-r--r-- | misc/Makefile | 2 | ||||
-rw-r--r-- | misc/sys/cdefs.h | 15 | ||||
-rw-r--r-- | misc/sys/uio.h | 14 | ||||
-rw-r--r-- | stdlib/Makefile | 5 | ||||
-rw-r--r-- | stdlib/rpmatch.c | 62 | ||||
-rw-r--r-- | stdlib/stdlib.h | 9 | ||||
-rw-r--r-- | sysdeps/generic/iovec.h | 9 | ||||
-rw-r--r-- | sysdeps/unix/readdir.c | 11 | ||||
-rw-r--r-- | sysdeps/unix/sysdep.h | 3 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/iovec.h | 3 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/m68k/sysdep.h | 3 |
16 files changed, 255 insertions, 74 deletions
diff --git a/ChangeLog b/ChangeLog index e259705895..1fd468b8fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,38 @@ +Mon Mar 25 03:35:16 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu> + + * malloc/malloc.c (morecore): Don't attempt recursive realloc of info + table when _heaplimit==0 during realloc growing large block. + + * MakeTAGS (extract): Remove /dev/null from xgettext command line. + (text-srcs): New variable: extract only C sources from $(tags_sources). + (po/$(domain).pot): Depend on that. + If it's empty, cp /dev/null $@ instead of $(extract). + + * misc/Makefile (headers): Add iovec.h. + * sysdeps/unix/sysv/linux/iovec.h: New file. + * sysdeps/generic/iovec.h: New file. + * misc/sys/uio.h (struct iovec): Type replaced with #include <iovec.h>. + + * configure.in (NO_UNDERSCORES check): Use AC_TRY_LINK instead of + AC_TRY_COMPILE. + + * misc/sys/cdefs.h [__USE_BSD] (const, signed, volatile): Move these + macros inside [! __STDC__]. + + * stdlib/rpmatch.c: New file. + * stdlib/Makefile (routines): Add rpmatch. + * stdlib/stdlib.h [__USE_SVID]: Declare rpmatch. + + * MakeTAGS (MSGJOIN): Variable removed. + (po/SYS_libc.pot): Use $(XGETTEXT) instead of $(MSGJOIN). + +Wed Mar 20 20:08:46 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * sysdeps/unix/sysdep.h: Don't define C_SYMBOL_NAME. + + * sysdeps/unix/sysv/linux/m68k/sysdep.h: Don't define + NO_UNDERSCORES. + Thu Mar 21 11:19:15 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu> * mach/devstream.c (input): Translate \r to \n on input. diff --git a/MakeTAGS b/MakeTAGS index 1a32d6d480..0217a68c10 100644 --- a/MakeTAGS +++ b/MakeTAGS @@ -118,9 +118,6 @@ endif # subdir ifndef XGETTEXT XGETTEXT = xgettext endif -ifndef MSGJOIN -MSGJOIN = msgjoin -endif P = $(..)po @@ -133,11 +130,17 @@ endif define extract @rm -f $@.new $(XGETTEXT) --keyword=_ --keyword=N_ --sort-output -d - \ - $(XGETTEXTFLAGS-$(@F)) > $@.new /dev/null $^ + $(XGETTEXTFLAGS-$(@F)) > $@.new $^ mv -f $@.new $@ endef -$P/$(domain).pot: $(tags_sources); $(extract) +text-srcs := $(filter %.c %.h %.cc %.C,$(tags_sources)) +$P/$(domain).pot: $(text-srcs) +ifeq (,$(text-srcs)) + cp /dev/null $@ +else + $(extract) +endif $P/siglist.pot: $(common-objpfx)siglist.c; $(extract) $P/errlist.pot: $(..)sysdeps/mach/hurd/errlist.c; $(extract) @@ -152,7 +155,7 @@ all-pot = $P/libc-top.pot $(subdirs:%=$P/%.pot) \ ifndef subdir $P/SYS_libc.pot: $(all-pot) @rm -f $@.new - $(MSGJOIN) $^ > $@.new + $(XGETTEXT) -d - --omit-header $^ > $@.new mv -f $@.new $@ test ! -d CVS || cvs ci -m'Regenerated from source files' $@ diff --git a/configure b/configure index 3e44304275..83715cdda7 100755 --- a/configure +++ b/configure @@ -1381,7 +1381,7 @@ int t() { glibc_foobar (); ; return 0; } EOF -if { (eval echo configure:1385: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1385: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* libc_cv_asm_underscores=yes else diff --git a/configure.in b/configure.in index 6f18093461..b2727d54f2 100644 --- a/configure.in +++ b/configure.in @@ -413,9 +413,9 @@ if test $elf = yes; then libc_cv_asm_underscores=no else AC_CACHE_CHECK(for _ prefix on C symbol names, libc_cv_asm_underscores, - [AC_TRY_COMPILE([asm ("_glibc_foobar:");], [glibc_foobar ();], - libc_cv_asm_underscores=yes, - libc_cv_asm_underscores=no)]) + [AC_TRY_LINK([asm ("_glibc_foobar:");], [glibc_foobar ();], + libc_cv_asm_underscores=yes, + libc_cv_asm_underscores=no)]) fi if test $libc_cv_asm_underscores = no; then AC_DEFINE(NO_UNDERSCORES) diff --git a/intl/finddomain.c b/intl/finddomain.c index 07c5f44799..45773ee306 100644 --- a/intl/finddomain.c +++ b/intl/finddomain.c @@ -1,5 +1,5 @@ /* finddomain.c -- handle list of needed message catalogs - Copyright (C) 1995 Free Software Foundation, Inc. + Copyright (C) 1995, 1996 Free Software Foundation, Inc. Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. This program is free software; you can redistribute it and/or modify @@ -63,20 +63,21 @@ void free (); /* Rename the non ANSI C functions. This is required by the standard because some ANSI C functions will require linking with this object file and the name space must not be polluted. */ -# define stpcpy __stpcpy +# define stpcpy(dest, src) __stpcpy(dest, src) #endif /* Encoding of locale name parts. */ -#define CEN_REVISION 1 -#define CEN_SPONSOR 2 -#define CEN_SPECIAL 4 -#define XPG_CODESET 8 -#define TERRITORY 16 -#define CEN_AUDIENCE 32 -#define XPG_MODIFIER 64 +#define CEN_REVISION 1 +#define CEN_SPONSOR 2 +#define CEN_SPECIAL 4 +#define XPG_NORM_CODESET 8 +#define XPG_CODESET 16 +#define TERRITORY 32 +#define CEN_AUDIENCE 64 +#define XPG_MODIFIER 128 #define CEN_SPECIFIC (CEN_REVISION|CEN_SPONSOR|CEN_SPECIAL|CEN_AUDIENCE) -#define XPG_SPECIFIC (XPG_CODESET|XPG_MODIFIER) +#define XPG_SPECIFIC (XPG_CODESET|XPG_NORM_CODESET|XPG_MODIFIER) /* List of already loaded domains. */ @@ -88,6 +89,7 @@ static struct loaded_domain *make_entry_rec PARAMS ((const char *dirname, const char *language, const char *territory, const char *codeset, + const char *normalized_codeset, const char *modifier, const char *special, const char *sponsor, @@ -95,9 +97,13 @@ static struct loaded_domain *make_entry_rec PARAMS ((const char *dirname, const char *domainname, int do_allocate)); +/* Normalize name of selected codeset. */ +static const char *normalize_codeset PARAMS ((const char *codeset)); + /* Substitution for systems lacking this function in their C library. */ #if !_LIBC && !HAVE_STPCPY -static char *stpcpy PARAMS ((char *dest, const char *src)); +static char *stpcpy__ PARAMS ((char *dest, const char *src)); +# define stpcpy(dest, src) stpcpy__ (dest, src) #endif @@ -116,6 +122,7 @@ _nl_find_domain (dirname, locale, domainname) const char *modifier = NULL; const char *territory = NULL; const char *codeset = NULL; + const char *normalized_codeset = NULL; const char *special = NULL; const char *sponsor = NULL; const char *revision = NULL; @@ -141,13 +148,14 @@ _nl_find_domain (dirname, locale, domainname) (2) sponsor (3) special (4) codeset - (5) territory - (6) audience/modifier + (5) normalized codeset + (6) territory + (7) audience/modifier */ /* If we have already tested for this locale entry there has to be one data set in the list of loaded domains. */ - retval = make_entry_rec (dirname, 0, locale, NULL, NULL, NULL, + retval = make_entry_rec (dirname, 0, locale, NULL, NULL, NULL, NULL, NULL, NULL, NULL, domainname, 0); if (retval != NULL) { @@ -225,6 +233,15 @@ _nl_find_domain (dirname, locale, domainname) ++cp; mask |= XPG_CODESET; + + if (codeset != cp && codeset[0] != '\0') + { + normalized_codeset = normalize_codeset (codeset); + if (strcmp (codeset, normalized_codeset) == 0) + free ((char *) normalized_codeset); + else + mask |= XPG_NORM_CODESET; + } } } @@ -297,8 +314,8 @@ _nl_find_domain (dirname, locale, domainname) /* Create all possible locale entries which might be interested in generalzation. */ retval = make_entry_rec (dirname, mask, language, territory, codeset, - modifier, special, sponsor, revision, - domainname, 1); + normalized_codeset, modifier, special, sponsor, + revision, domainname, 1); if (retval == NULL) /* This means we are out of core. */ return NULL; @@ -331,13 +348,15 @@ _nl_find_domain (dirname, locale, domainname) static struct loaded_domain * -make_entry_rec (dirname, mask, language, territory, codeset, modifier, - special, sponsor, revision, domain, do_allocate) +make_entry_rec (dirname, mask, language, territory, codeset, + normalized_codeset, modifier, special, sponsor, revision, + domain, do_allocate) const char *dirname; int mask; const char *language; const char *territory; const char *codeset; + const char *normalized_codeset; const char *modifier; const char *special; const char *sponsor; @@ -358,23 +377,26 @@ make_entry_rec (dirname, mask, language, territory, codeset, modifier, both syntaces set this is necessary to prevent constructing illegal local names. */ /* FIXME: Rewrite because test is necessary only in first round. */ - if ((mask & CEN_SPECIFIC) == 0 || (mask & XPG_SPECIFIC) == 0) + if ((mask & CEN_SPECIFIC) == 0 || (mask & XPG_SPECIFIC) == 0 + || ((mask & XPG_CODESET) != 0 && (mask & XPG_NORM_CODESET) != 0)) { /* Allocate room for the full file name. */ filename = (char *) malloc (strlen (dirname) + 1 + strlen (language) + ((mask & TERRITORY) != 0 - ? strlen (territory) : 0) + ? strlen (territory) + 1 : 0) + ((mask & XPG_CODESET) != 0 - ? strlen (codeset) : 0) + ? strlen (codeset) + 1 : 0) + + ((mask & XPG_NORM_CODESET) != 0 + ? strlen (normalized_codeset) + 1 : 0) + ((mask & XPG_MODIFIER) != 0 ? - strlen (modifier) : 0) + strlen (modifier) + 1 : 0) + ((mask & CEN_SPECIAL) != 0 - ? strlen (special) : 0) + ? strlen (special) + 1 : 0) + ((mask & CEN_SPONSOR) != 0 - ? strlen (sponsor) : 0) + ? strlen (sponsor) + 1 : 0) + ((mask & CEN_REVISION) != 0 - ? strlen (revision) : 0) + 1 + ? strlen (revision) + 1 : 0) + 1 + strlen (domain) + 1); if (filename == NULL) @@ -396,7 +418,12 @@ make_entry_rec (dirname, mask, language, territory, codeset, modifier, if ((mask & XPG_CODESET) != 0) { *cp++ = '.'; - cp = stpcpy (cp, codeset); + cp = stpcpy (cp, codeset); + } + if ((mask & XPG_NORM_CODESET) != 0) + { + *cp++ = '.'; + cp = stpcpy (cp, normalized_codeset); } if ((mask & (XPG_MODIFIER | CEN_AUDIENCE)) != 0) { @@ -470,20 +497,64 @@ make_entry_rec (dirname, mask, language, territory, codeset, modifier, } entries = 0; - for (cnt = 126; cnt >= 0; --cnt) + for (cnt = 254; cnt >= 0; --cnt) if (cnt < mask && (cnt & ~mask) == 0 - && ((cnt & CEN_SPECIFIC) == 0 || (cnt & XPG_SPECIFIC) == 0)) + && ((cnt & CEN_SPECIFIC) == 0 || (cnt & XPG_SPECIFIC) == 0) + && ((cnt & XPG_CODESET) == 0 || (cnt & XPG_NORM_CODESET) == 0)) retval->successor[entries++] = make_entry_rec (dirname, cnt, language, territory, - codeset, modifier, - special, sponsor, - revision, domain, 1); + codeset, + normalized_codeset, + modifier, special, + sponsor, revision, + domain, 1); retval->successor[entries] = NULL; return retval; } +static const char * +normalize_codeset (codeset) + const char *codeset; +{ + int len = 0; + int only_digit = 1; + const char *cp; + char *retval; + char *wp; + + for (cp = codeset; cp[0] != '\0'; ++cp) + if (isalnum (cp[0])) + { + ++len; + + if (isalpha (cp[0])) + only_digit = 0; + } + + retval = (char *) malloc ((only_digit ? 3 : 0) + len + 1); + + if (retval != NULL) + { + if (only_digit) + wp = stpcpy (retval, "ISO"); + else + wp = retval; + + for (cp = codeset; cp[0] != '\0'; ++cp) + if (isalpha (cp[0])) + *wp++ = toupper (cp[0]); + else if (isdigit (cp[0])) + *wp++ = cp[0]; + + *wp = '\0'; + } + + return (const char *) retval; +} + + /* @@ begin of epilog @@ */ /* We don't want libintl.a to depend on any other library. So we @@ -492,7 +563,7 @@ make_entry_rec (dirname, mask, language, territory, codeset, modifier, to be defined. */ #if !_LIBC && !HAVE_STPCPY static char * -stpcpy (dest, src) +stpcpy__ (dest, src) char *dest; const char *src; { diff --git a/misc/Makefile b/misc/Makefile index ff633544de..2189ceaae3 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -22,7 +22,7 @@ subdir := misc -headers := sys/uio.h sys/ioctl.h sys/ptrace.h ioctls.h sys/file.h \ +headers := sys/uio.h iovec.h sys/ioctl.h sys/ptrace.h ioctls.h sys/file.h\ a.out.h nlist.h stab.h stab.def sgtty.h sys/dir.h sys/cdefs.h \ ttyent.h syscall.h syslog.h sys/syslog.h paths.h sys/reboot.h \ sys/mman.h sys/param.h fstab.h mntent.h search.h utmp.h \ diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h index 8336aa4038..983526a075 100644 --- a/misc/sys/cdefs.h +++ b/misc/sys/cdefs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc. +/* Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -73,18 +73,19 @@ typedef long double __long_double_t; #define __ptr_t char * typedef double __long_double_t; -#endif - -/* The BSD header files use the ANSI keywords unmodified. (This means that - old programs may lose if they use the new keywords as identifiers.) We - define them to their __ versions, which are taken care of above. */ - +/* The BSD header files use the ANSI keywords unmodified (this means that + old programs may lose if they use the new keywords as identifiers), but + those names are not available under -traditional. We define them to + their __ versions, which are taken care of above. */ #ifdef __USE_BSD #define const __const #define signed __signed #define volatile __volatile #endif +#endif /* __STDC__ */ + + /* C++ needs to know that types and declarations are C, not C++. */ #ifdef __cplusplus #define __BEGIN_DECLS extern "C" { diff --git a/misc/sys/uio.h b/misc/sys/uio.h index 301712546f..491d534e75 100644 --- a/misc/sys/uio.h +++ b/misc/sys/uio.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -26,16 +26,8 @@ __BEGIN_DECLS #define __need_size_t #include <stddef.h> - -/* Structure describing a section of memory. */ - -struct iovec -{ - /* Starting address. */ - __ptr_t iov_base; - /* Length in bytes. */ - size_t iov_len; -}; +/* This file defines `struct iovec'. */ +#include <iovec.h> /* Read data from file descriptor FD, and put the result in the diff --git a/stdlib/Makefile b/stdlib/Makefile index 77940d15eb..54a95fda05 100644 --- a/stdlib/Makefile +++ b/stdlib/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. +# Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -41,7 +41,8 @@ routines := \ strtol strtoul strtoq strtouq \ strtof strtod strtold \ system \ - a64l l64a + a64l l64a \ + rpmatch distribute := exit.h grouping.h tests := tst-strtol tst-strtod testmb testrand testsort testdiv diff --git a/stdlib/rpmatch.c b/stdlib/rpmatch.c new file mode 100644 index 0000000000..0dcaa6dc87 --- /dev/null +++ b/stdlib/rpmatch.c @@ -0,0 +1,62 @@ +/* rpmatch - determine whether string value is affirmation or negative + response according to current locale's data +Copyright (C) 1996 Free Software Foundation, Inc. + +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include <langinfo.h> +#include <stdlib.h> +#include <regex.h> + + +int +rpmatch (response) + const char *response; +{ + /* Match against one of the response patterns, compiling the pattern + first if necessary. */ + inline int try (const int tag, const int match, + const char **lastp, regex_t *re) + { + const char *pattern = nl_langinfo (tag); + if (pattern != *lastp) + { + /* The pattern has changed. */ + if (*lastp) + { + /* Free the old compiled pattern. */ + regfree (re); + *lastp = NULL; + } + /* Compile the pattern and cache it for future runs. */ + if (regcomp (re, pattern, REG_EXTENDED) != 0) + return -1; + *lastp = pattern; + } + + /* Try the pattern. */ + return regexec (re, response, 0, NULL, 0) == 0 ? match : !match; + } + + /* We cache the response patterns and compiled regexps here. */ + static const char *yesexpr, *noexpr; + static regex_t yesre, nore; + + return (try (YESEXPR, 1, &yesexpr, &yesre) ?: + try (NOEXPR, 0, &noexpr, &nore)); +} diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h index 65932e3d17..793c641671 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h @@ -444,6 +444,15 @@ extern size_t mbstowcs __P ((wchar_t * __pwcs, __const char *__s, size_t __n)); extern size_t wcstombs __P ((char *__s, __const wchar_t * __pwcs, size_t __n)); +#ifdef __USE_SVID +/* Determine whether the string value of RESPONSE matches the affirmation + or negative response expression as specified by the LC_MESSAGES category + in the program's current locale. Returns 1 if affirmative, 0 if + negative, and -1 if not matching. */ +extern int rpmatch __P ((__const char *__response)); +#endif + + __END_DECLS #endif /* stdlib.h */ diff --git a/sysdeps/generic/iovec.h b/sysdeps/generic/iovec.h new file mode 100644 index 0000000000..307fc6a18a --- /dev/null +++ b/sysdeps/generic/iovec.h @@ -0,0 +1,9 @@ +/* `struct iovec' -- Structure describing a section of memory. */ + +struct iovec +{ + /* Starting address. */ + __ptr_t iov_base; + /* Length in bytes. */ + size_t iov_len; +}; diff --git a/sysdeps/unix/readdir.c b/sysdeps/unix/readdir.c index 84ac033e09..00446a2d2b 100644 --- a/sysdeps/unix/readdir.c +++ b/sysdeps/unix/readdir.c @@ -52,11 +52,12 @@ readdir (DIR *dirp) off_t base; ssize_t bytes; - if (sizeof (dp->d_name) > 1) - /* Fixed-size struct; must read one at a time (see below). */ - maxread = sizeof *dp; - else - maxread = dirp->allocation; +#ifndef _DIRENT_HAVE_D_RECLEN + /* Fixed-size struct; must read one at a time (see below). */ + maxread = sizeof *dp; +#else + maxread = dirp->allocation; +#endif base = dirp->filepos; bytes = __getdirentries (dirp->fd, dirp->data, maxread, &base); diff --git a/sysdeps/unix/sysdep.h b/sysdeps/unix/sysdep.h index 07c539b78a..456970638c 100644 --- a/sysdeps/unix/sysdep.h +++ b/sysdeps/unix/sysdep.h @@ -36,7 +36,6 @@ Cambridge, MA 02139, USA. */ /* Define a macro we can use to construct the asm name for a C symbol. */ #ifdef NO_UNDERSCORES -#define C_SYMBOL_NAME(name) name #ifdef __STDC__ #define C_LABEL(name) name##: #else @@ -44,10 +43,8 @@ Cambridge, MA 02139, USA. */ #endif #else #ifdef __STDC__ -#define C_SYMBOL_NAME(name) _##name #define C_LABEL(name) _##name##: #else -#define C_SYMBOL_NAME(name) _/**/name #define C_LABEL(name) _/**/name/**/: #endif #endif diff --git a/sysdeps/unix/sysv/linux/iovec.h b/sysdeps/unix/sysv/linux/iovec.h new file mode 100644 index 0000000000..6e5e01d9b3 --- /dev/null +++ b/sysdeps/unix/sysv/linux/iovec.h @@ -0,0 +1,3 @@ +/* The Linux kernel header defines `struct iovec' for us. */ + +#include <linux/uio.h> diff --git a/sysdeps/unix/sysv/linux/m68k/sysdep.h b/sysdeps/unix/sysv/linux/m68k/sysdep.h index ee481172d3..fe2c6aa823 100644 --- a/sysdeps/unix/sysv/linux/m68k/sysdep.h +++ b/sysdeps/unix/sysv/linux/m68k/sysdep.h @@ -18,9 +18,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* In the Linux/ELF world, C symbols are asm symbols. */ -#define NO_UNDERSCORES - #include <sysdeps/unix/sysdep.h> /* For Linux we can use the system call table in the header file |