diff options
33 files changed, 1267 insertions, 342 deletions
@@ -1,3 +1,71 @@ +1997-03-09 06:59 Ulrich Drepper <drepper@cygnus.com> + + * Makeconfig: Add ASFLAGS-% flags for SPARC assembler which need + -fPIC. + * Makerules (compile.S): Use ASFLAGS-%. + (COMPILE.S): Likewise. + * config.make.in (ASFLAGS-.so): Define from ASFLAGS_SO. + * configure.in: Substitute ASFLAGS_SO. + * sysdeps/sparc/configure.in: New file. + + * posix/unitstd.h: Add prototype for __euidaccess. + * sysdeps/posix/euidaccess.c: Define as __euidaccess and make + euidaccess weak alias. + * sysdeps/stubs/euidaccess.c: Likewise. + * inet/rcmd.c: Use __ protected versions of non-standard functions. + + * locale/setlocale.c (setlocale): Don't set usage_count to + MAX_USAGE_COUNT if it already has this value. + + * locale/programs/localedef.c: Don't use LOCALE_PATH to find + binary locale files. Use LOCALEDIR only. + * locale/programs/locfile.c: When named file not found and not + absolute use path in I18NPATH. + + * stdlib/Makefile (headers): Add inttypes.h. + + * sysdpes/generic/socketbits.h: Add PF_FILE as synonym for PF_LOCAL + and AF_FILE as synonym for AF_LOCAL. + * sysdpes/unix/sysv/linux/socketbits.h: Likewise. + + * time/Makefile: Rewrite rules for test to handle parallel builds. + +1997-03-09 05:26 Ulrich Drepper <drepper@cygnus.com> + + * manual/startup.texi (EXIT_FAILURE): Fix typo. Patch by + robbe@orcus.priv.at. + +1997-03-09 05:10 Edward Seidl <seidl@janed.com> + + * sysdeps/i386/elf/start.S (nofini): *Really* align stack to + 8-byte boundary. + +1997-03-09 01:48 Ulrich Drepper <drepper@cygnus.com> + + * elf/link.h: Define __need_NULL to get definition. Include + <features.h>. + Patch by Andreas Jaeger <aj@arthur.pfalz.de>. + +1997-03-08 21:48 Thorsten Kukuk <kukuk@tk.uni-paderborn.de> + + Rewrite NIS code to allow empty keys. + * nis/nss_nis/nis-ethers.c: Rewritten. + * nis/nss_nis/nis-proto.c: Rewritten. + * nis/nss_nis/nis-publickey.c: Rewritten. + * nis/nss_nis/nis-rpc.c: Rewritten. + * nis/nss_nis/nis-service.c: Rewritten. + +1997-03-08 16:02 Andreas Jaeger <aj@arthur.pfalz.de> + + * time/scheck.c (scheck): Add extra const to second argument. + + * time/private.h: Correct prototypes to match definition. + +1997-03-08 18:55 Ulrich Drepper <drepper@cygnus.com> + + * sysdeps/alpha/__math.h: Remove cabs inline definition. + Reported by Philip Blundell <pjb27@cam.ac.uk>. + 1997-03-08 05:30 Ulrich Drepper <drepper@cygnus.com> * argp/Makefile (routines): Add argp-eexst. @@ -145,14 +213,14 @@ * sysdeps/libm-ieee754/s_fpclassify.c (__fpclassify): Don't use non-existing GET_WORDS macro, use EXTRACT_WORDS. - Reported by Andres Schwab <schwab@issan.informatik.uni-dortmund.de>. + Reported by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>. 1997-03-07 05:27 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/sysv/linux/i386/sigaction.c: The user- and kernel-level sigaction structure is different. handle this correctly. - Bug report by Andres Jaeger <jaeger@informatik.uni-kl.de>. + Bug report by Andreas Jaeger <jaeger@informatik.uni-kl.de>. 1997-03-06 05:55 David Engel <david@sw.ods.com> @@ -490,6 +490,9 @@ object-suffixes += .so CPPFLAGS-.so = -DPIC CFLAGS-.so = -fPIC -fno-common libtype.so := lib%_pic.a +ifndef ASFLAGS-.so +ASFLAGS-.so = +endif endif ifeq (yes,$(build-profile)) # Under --enable-profile, we will build a static library of profiled objects. @@ -498,6 +501,9 @@ object-suffixes += .po CPPFLAGS-.po = -DPROF CFLAGS-.po = -pg libtype.po = lib%_p.a +ifndef ASFLAGS-.po +ASFLAGS-.po = +endif endif ifeq (yes,$(build-omitfp)) # Under --enable-omitfp, we build an the library optimized without @@ -508,6 +514,9 @@ CFLAGS-.go = -g CFLAGS-.o = -g0 -O99 -fomit-frame-pointer CFLAGS-.so += $(CFLAGS-.o) libtype.go = lib%_g.a +ifndef ASFLAGS-.go +ASFLAGS-.go = +endif endif ifeq (yes,$(build-bounded)) # Under --enable-bounded, we build the library with `-fbounded-pointers -g' @@ -516,6 +525,9 @@ object-suffixes += .bo CPPFLAGS-.bo = -DBOUNDED_POINTERS CFLAGS-.bo = -g -fbounded-pointers libtype.bo = lib%_b.a +ifndef ASFLAGS-.bo +ASFLAGS-.bo = +endif endif @@ -294,8 +294,10 @@ endif # GCC can grok options after the file name, and it looks nicer that way. compile.c = $(CC) $< -c $(CFLAGS) $(CPPFLAGS) -compile.S = $(CC) $< -c $(CPPFLAGS) -DASSEMBLER $(asm-CPPFLAGS) -COMPILE.S = $(CC) -c $(CPPFLAGS) -DASSEMBLER $(asm-CPPFLAGS) +compile.S = \ + $(CC) $< -c $(CPPFLAGS) -DASSEMBLER $(asm-CPPFLAGS) $(ASFLAGS-$(suffix $@)) +COMPILE.S = \ + $(CC) -c $(CPPFLAGS) -DASSEMBLER $(asm-CPPFLAGS) $(ASFLAGS-$(suffix $@)) COMPILE.s = $(filter-out -pipe,$(CC)) -c $(ASFLAGS) # We need this for the output to go in the right place. It will default to diff --git a/config.make.in b/config.make.in index 0a7d037..8f72139 100644 --- a/config.make.in +++ b/config.make.in @@ -51,6 +51,9 @@ AR = @AR@ RANLIB = @RANLIB@ AS = $(CC) -c +# Build tool flags. +ASFLAGS-.so = @ASFLAGS_SO@ + # Installation tools. INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -2037,6 +2037,8 @@ fi + + if test "`(cd $srcdir; pwd)`" = "`pwd`"; then config_makefile= else @@ -2223,6 +2225,7 @@ s%@profile@%$profile%g s%@omitfp@%$omitfp%g s%@bounded@%$bounded%g s%@DEFINES@%$DEFINES%g +s%@ASFLAGS_SO@%$ASFLAGS_SO%g s%@VERSION@%$VERSION%g CEOF diff --git a/configure.in b/configure.in index f36bcaf..44147ca 100644 --- a/configure.in +++ b/configure.in @@ -810,6 +810,8 @@ AC_SUBST(bounded) AC_SUBST(DEFINES) +AC_SUBST(ASFLAGS_SO) + if test "`(cd $srcdir; pwd)`" = "`pwd`"; then config_makefile= else @@ -18,9 +18,12 @@ Boston, MA 02111-1307, USA. */ #ifndef _LINK_H + #define _LINK_H 1 +#include <features.h> #define __need_size_t +#define __need_NULL #include <stddef.h> #include <elf.h> diff --git a/inet/rcmd.c b/inet/rcmd.c index 354ff35..0ee0c5d 100644 --- a/inet/rcmd.c +++ b/inet/rcmd.c @@ -326,7 +326,7 @@ again: char *buffer = __alloca (buflen); first = 0; - if (getpwnam_r (luser, &pwdbuf, buffer, buflen, &pwd) < 0) + if (__getpwnam_r (luser, &pwdbuf, buffer, buflen, &pwd) < 0) return -1; dirlen = strlen (pwd->pw_dir); @@ -339,7 +339,7 @@ again: * reading an NFS mounted file system, can't read files that * are protected read/write owner only. */ - if (euidaccess (pbuf, R_OK) != 0) + if (__euidaccess (pbuf, R_OK) != 0) hostf = NULL; else hostf = fopen(pbuf, "r"); diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c index 96ff12e..1830be3 100644 --- a/locale/programs/localedef.c +++ b/locale/programs/localedef.c @@ -240,21 +240,23 @@ main (int argc, char *argv[]) if (! avail) { - const char *locale_names[] = { "LC_COLLATE", "LC_CTYPE", - "LC_MONETARY", "LC_NUMERIC", - "LC_TIME", "LC_MESSAGES" }; + static const char *locale_names[] = + { + "LC_COLLATE", "LC_CTYPE", "LC_MONETARY", + "LC_NUMERIC", "LC_TIME", "LC_MESSAGES" + }; char *fname; int fd; struct stat st; - asprintf (&fname, LOCALE_PATH "/%s/%s", act_add_locdef->name, + asprintf (&fname, LOCALEDIR "/%s/%s", act_add_locdef->name, locale_names[cat]); fd = open (fname, O_RDONLY); if (fd == -1) { free (fname); - asprintf (&fname, LOCALE_PATH "/%s/%s/SYS_%s", + asprintf (&fname, LOCALEDIR "/%s/%s/SYS_%s", act_add_locdef->name, locale_names[cat], locale_names[cat]); diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c index 4ab0425..aecc891 100644 --- a/locale/programs/locfile.c +++ b/locale/programs/locfile.c @@ -26,6 +26,7 @@ #include <locale.h> #include <malloc.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/stat.h> @@ -76,10 +77,31 @@ locfile_read (const char *filename, struct charset_t *charset) { if (filename[0] != '/') { - char path[strlen (filename) + 1 + sizeof (LOCSRCDIR)]; + char *i18npath = __secure_getenv ("I18NPATH"); + if (i18npath != NULL && *i18npath != '\0') + { + char path[strlen (filename) + 1 + strlen (i18npath) + 1]; + char *next; + i18npath = strdupa (i18npath); + + + while (ldfile == NULL + && (next = strsep (&i18npath, ":")) != NULL) + { + stpcpy (stpcpy (stpcpy (path, next), "/"), filename); + + ldfile = lr_open (path, locfile_hash); + } + } - stpcpy (stpcpy (stpcpy (path, LOCSRCDIR), "/"), filename); - ldfile = lr_open (path, locfile_hash); + /* Test in the default directory. */ + if (ldfile == NULL) + { + char path[strlen (filename) + 1 + sizeof (LOCSRCDIR)]; + + stpcpy (stpcpy (stpcpy (path, LOCSRCDIR), "/"), filename); + ldfile = lr_open (path, locfile_hash); + } } if (ldfile == NULL) diff --git a/locale/setlocale.c b/locale/setlocale.c index 12e6569..4eceea6 100644 --- a/locale/setlocale.c +++ b/locale/setlocale.c @@ -368,7 +368,8 @@ setlocale (int category, const char *locale) /* We must not simply free a global locale since we have no control over the usage. So we mark it as un-deletable. */ - newdata->usage_count = MAX_USAGE_COUNT; + if (newdata->usage_count != MAX_USAGE_COUNT) + newdata->usage_count = MAX_USAGE_COUNT; } /* Create new composite name. */ diff --git a/manual/startup.texi b/manual/startup.texi index 426f949..db6a4c8 100644 --- a/manual/startup.texi +++ b/manual/startup.texi @@ -830,7 +830,7 @@ unsuccessful program completion in a general sense. On POSIX systems, the value of this macro is @code{1}. On other systems, the value might be some other (possibly non-constant) integer -expression. Other nonzero status values also indicate future. Certain +expression. Other nonzero status values also indicate failures. Certain programs use different nonzero status values to indicate particular kinds of "non-success". For example, @code{diff} uses status value @code{1} to mean that the files are different, and @code{2} or more to diff --git a/nis/nss_nis/nis-ethers.c b/nis/nss_nis/nis-ethers.c index d257cd7..c6656ee 100644 --- a/nis/nss_nis/nis-ethers.c +++ b/nis/nss_nis/nis-ethers.c @@ -43,43 +43,101 @@ struct ether #define EXTERN_PARSER #include "../nss/nss_files/files-parse.c" -static bool_t new_start = 1; -static char *oldkey = NULL; -static int oldkeylen = 0; +struct response +{ + char *val; + struct response *next; +}; -enum nss_status -_nss_nis_setetherent (void) +static struct response *start = NULL; +static struct response *next = NULL; + +static int +saveit (int instatus, char *inkey, int inkeylen, char *inval, + int invallen, char *indata) { - __libc_lock_lock (lock); + if (instatus != YP_TRUE) + return instatus; - new_start = 1; - if (oldkey != NULL) + if (inkey && inkeylen > 0 && inval && invallen > 0) { - free (oldkey); - oldkey = NULL; - oldkeylen = 0; + if (start == NULL) + { + start = malloc (sizeof (struct response)); + next = start; + } + else + { + next->next = malloc (sizeof (struct response)); + next = next->next; + } + next->next = NULL; + next->val = malloc (invallen + 1); + strncpy (next->val, inval, invallen); + next->val[invallen] = '\0'; } + + return 0; +} - __libc_lock_unlock (lock); +enum nss_status +internal_nis_setetherent (void) +{ + char *domainname; + struct ypall_callback ypcb; + + yp_get_default_domain(&domainname); + + while (start != NULL) + { + if (start->val != NULL) + free (start->val); + next = start; + start = start->next; + free (next); + } + start = NULL; + + ypcb.foreach = saveit; + ypcb.data = NULL; + yp_all(domainname, "ethers.byname", &ypcb); + next = start; return NSS_STATUS_SUCCESS; } enum nss_status +_nss_nis_setetherent (void) +{ + enum nss_status result; + + __libc_lock_lock (lock); + + result = internal_nis_setetherent (); + + __libc_lock_unlock (lock); + + return result; +} + +enum nss_status _nss_nis_endetherent (void) { __libc_lock_lock (lock); - new_start = 1; - if (oldkey != NULL) + while (start != NULL) { - free (oldkey); - oldkey = NULL; - oldkeylen = 0; + if (start->val != NULL) + free (start->val); + next = start; + start = start->next; + free (next); } - + start = NULL; + next = NULL; + __libc_lock_unlock (lock); - + return NSS_STATUS_SUCCESS; } @@ -87,54 +145,27 @@ static enum nss_status internal_nis_getetherent_r (struct ether *eth, char *buffer, size_t buflen) { struct parser_data *data = (void *) buffer; - char *domain, *result, *outkey; - int len, keylen, parse_res; + int parse_res; - if (yp_get_default_domain (&domain)) - return NSS_STATUS_UNAVAIL; + if (start == NULL) + internal_nis_setetherent (); /* Get the next entry until we found a correct one. */ do { - enum nss_status retval; char *p; - - if (new_start) - retval = yperr2nss (yp_first (domain, "ethers.byaddr", - &outkey, &keylen, &result, &len)); - else - retval = yperr2nss ( yp_next (domain, "ethers.byaddr", - oldkey, oldkeylen, - &outkey, &keylen, &result, &len)); - - if (retval != NSS_STATUS_SUCCESS) - { - if (retval == NSS_STATUS_TRYAGAIN) - __set_errno (EAGAIN); - return retval; - } - - if ((size_t) (len + 1) > buflen) - { - free (result); - __set_errno (ERANGE); - return NSS_STATUS_TRYAGAIN; - } - - p = strncpy (buffer, result, len); - buffer[len] = '\0'; + + if (next == NULL) + return NSS_STATUS_NOTFOUND; + p = strcpy (buffer, next->val); + next = next->next; + while (isspace (*p)) ++p; - free (result); - + parse_res = _nss_files_parse_etherent (p, eth, data, buflen); if (!parse_res && errno == ERANGE) return NSS_STATUS_TRYAGAIN; - - free (oldkey); - oldkey = outkey; - oldkeylen = keylen; - new_start = 0; } while (!parse_res); diff --git a/nis/nss_nis/nis-proto.c b/nis/nss_nis/nis-proto.c index ccb95c3..3349fe5 100644 --- a/nis/nss_nis/nis-proto.c +++ b/nis/nss_nis/nis-proto.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996. @@ -35,26 +35,81 @@ __libc_lock_define_initialized (static, lock) -static bool_t new_start = 1; -static char *oldkey = NULL; -static int oldkeylen = 0; +struct response +{ + char *val; + struct response *next; +}; + +static struct response *start = NULL; +static struct response *next = NULL; + +static int +saveit (int instatus, char *inkey, int inkeylen, char *inval, + int invallen, char *indata) +{ + if (instatus != YP_TRUE) + return instatus; + + if (inkey && inkeylen > 0 && inval && invallen > 0) + { + if (start == NULL) + { + start = malloc (sizeof (struct response)); + next = start; + } + else + { + next->next = malloc (sizeof (struct response)); + next = next->next; + } + next->next = NULL; + next->val = malloc (invallen + 1); + strncpy (next->val, inval, invallen); + next->val[invallen] = '\0'; + } + + return 0; +} + +enum nss_status +internal_nis_setprotoent (void) +{ + char *domainname; + struct ypall_callback ypcb; + + yp_get_default_domain (&domainname); + + while (start != NULL) + { + if (start->val != NULL) + free (start->val); + next = start; + start = start->next; + free (next); + } + start = NULL; + + ypcb.foreach = saveit; + ypcb.data = NULL; + yp_all (domainname, "protocols.bynumber", &ypcb); + next = start; + + return NSS_STATUS_SUCCESS; +} enum nss_status _nss_nis_setprotoent (void) { + enum nss_status status; + __libc_lock_lock (lock); - new_start = 1; - if (oldkey != NULL) - { - free (oldkey); - oldkey = NULL; - oldkeylen = 0; - } + status = internal_nis_setprotoent (); __libc_lock_unlock (lock); - return NSS_STATUS_SUCCESS; + return status; } enum nss_status @@ -62,16 +117,19 @@ _nss_nis_endprotoent (void) { __libc_lock_lock (lock); - new_start = 1; - if (oldkey != NULL) + while (start != NULL) { - free (oldkey); - oldkey = NULL; - oldkeylen = 0; + if (start->val != NULL) + free (start->val); + next = start; + start = start->next; + free (next); } - + start = NULL; + next = NULL; + __libc_lock_unlock (lock); - + return NSS_STATUS_SUCCESS; } @@ -80,57 +138,30 @@ internal_nis_getprotoent_r (struct protoent *proto, char *buffer, size_t buflen) { struct parser_data *data = (void *) buffer; - char *domain, *result, *outkey; - int len, keylen, parse_res; + int parse_res; - if (yp_get_default_domain (&domain)) - return NSS_STATUS_UNAVAIL; + if (start == NULL) + internal_nis_setprotoent (); /* Get the next entry until we found a correct one. */ do { - enum nss_status retval; char *p; - - if (new_start) - retval = yperr2nss (yp_first (domain, "protocols.bynumber", - &outkey, &keylen, &result, &len)); - else - retval = yperr2nss ( yp_next (domain, "protocols.bynumber", - oldkey, oldkeylen, - &outkey, &keylen, &result, &len)); - - if (retval != NSS_STATUS_SUCCESS) - { - if (retval == NSS_STATUS_TRYAGAIN) - __set_errno (EAGAIN); - return retval; - } - - if ((size_t) (len + 1) > buflen) - { - free (result); - __set_errno (ERANGE); - return NSS_STATUS_TRYAGAIN; - } - - p = strncpy (buffer, result, len); - buffer[len] = '\0'; + + if (next == NULL) + return NSS_STATUS_NOTFOUND; + p = strcpy (buffer, next->val); + next = next->next; + while (isspace (*p)) ++p; - free (result); parse_res = _nss_files_parse_protoent (p, proto, data, buflen); if (!parse_res && errno == ERANGE) return NSS_STATUS_TRYAGAIN; - - free (oldkey); - oldkey = outkey; - oldkeylen = keylen; - new_start = 0; } while (!parse_res); - + return NSS_STATUS_SUCCESS; } diff --git a/nis/nss_nis/nis-publickey.c b/nis/nss_nis/nis-publickey.c index b9eda6a..aad4da5 100644 --- a/nis/nss_nis/nis-publickey.c +++ b/nis/nss_nis/nis-publickey.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996. @@ -130,6 +130,7 @@ parse_netid_str (const char *s, uid_t *uidp, gid_t *gidp, int *gidlenp, gid_t *gidlist) { char *p; + int gidlen; if (!s || !isdigit (*s)) { @@ -162,14 +163,15 @@ parse_netid_str (const char *s, uid_t *uidp, gid_t *gidp, int *gidlenp, *gidp = (atoi (p)); - *gidlenp = 0; -#if 0 + gidlen = 0; + while ((p = strchr (p, ',')) != NULL) { p++; - gidlist[*gidlenp++] = atoi (p); + gidlist[gidlen++] = atoi (p); } -#endif + + *gidlenp = gidlen; return NSS_STATUS_SUCCESS; } diff --git a/nis/nss_nis/nis-rpc.c b/nis/nss_nis/nis-rpc.c index 2dae9ea..c0e21d8 100644 --- a/nis/nss_nis/nis-rpc.c +++ b/nis/nss_nis/nis-rpc.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996. @@ -35,26 +35,75 @@ __libc_lock_define_initialized (static, lock) +struct response_t +{ + char *val; + struct response_t *next; +}; + struct intern_t { - bool_t new_start; - char *oldkey; - int oldkeylen; + struct response_t *start; + struct response_t *next; }; typedef struct intern_t intern_t; -static intern_t intern = {TRUE, NULL, 0}; +static intern_t intern = {NULL, NULL}; + +static int +saveit (int instatus, char *inkey, int inkeylen, char *inval, + int invallen, char *indata) +{ + intern_t *intern = (intern_t *)indata; + + if (instatus != YP_TRUE) + return instatus; + + if (inkey && inkeylen > 0 && inval && invallen > 0) + { + if (intern->start == NULL) + { + intern->start = malloc (sizeof (struct response_t)); + intern->next = intern->start; + } + else + { + intern->next->next = malloc (sizeof (struct response_t)); + intern->next = intern->next->next; + } + intern->next->next = NULL; + intern->next->val = malloc (invallen + 1); + strncpy (intern->next->val, inval, invallen); + intern->next->val[invallen] = '\0'; + } + + return 0; +} static enum nss_status -internal_nis_setrpcent (intern_t *data) +internal_nis_setrpcent (intern_t *intern) { - data->new_start = 1; - if (data->oldkey != NULL) + char *domainname; + struct ypall_callback ypcb; + + if (yp_get_default_domain (&domainname)) + return NSS_STATUS_UNAVAIL; + + while (intern->start != NULL) { - free (data->oldkey); - data->oldkey = NULL; - data->oldkeylen = 0; + if (intern->start->val != NULL) + free (intern->start->val); + intern->next = intern->start; + intern->start = intern->start->next; + free (intern->next); } + intern->start = NULL; + + ypcb.foreach = saveit; + ypcb.data = (char *)intern; + yp_all(domainname, "rpc.bynumber", &ypcb); + intern->next = intern->start; + return NSS_STATUS_SUCCESS; } @@ -73,15 +122,18 @@ _nss_nis_setrpcent (void) } static enum nss_status -internal_nis_endrpcent (intern_t *data) +internal_nis_endrpcent (intern_t *intern) { - data->new_start = 1; - if (data->oldkey != NULL) + while (intern->start != NULL) { - free (data->oldkey); - data->oldkey = NULL; - data->oldkeylen = 0; + if (intern->start->val != NULL) + free (intern->start->val); + intern->next = intern->start; + intern->start = intern->start->next; + free (intern->next); } + intern->start = NULL; + return NSS_STATUS_SUCCESS; } @@ -104,60 +156,28 @@ internal_nis_getrpcent_r (struct rpcent *rpc, char *buffer, size_t buflen, intern_t *data) { struct parser_data *pdata = (void *) buffer; - char *domain; - char *result; - int len, parse_res; - char *outkey; - int keylen; + int parse_res; char *p; - - if (yp_get_default_domain (&domain)) - return NSS_STATUS_UNAVAIL; - + + if (data->start == NULL) + internal_nis_setrpcent (data); + /* Get the next entry until we found a correct one. */ do { - enum nss_status retval; - - if (data->new_start) - retval = yperr2nss (yp_first (domain, "rpc.bynumber", - &outkey, &keylen, &result, &len)); - else - retval = yperr2nss ( yp_next (domain, "rpc.bynumber", - data->oldkey, data->oldkeylen, - &outkey, &keylen, &result, &len)); - - if (retval != NSS_STATUS_SUCCESS) - { - if (retval == NSS_STATUS_TRYAGAIN) - __set_errno (EAGAIN); - return retval; - } - - if ((size_t) (len + 1) > buflen) - { - free (result); - __set_errno (ERANGE); - return NSS_STATUS_TRYAGAIN; - } - - p = strncpy (buffer, result, len); - buffer[len] = '\0'; + if (data->next == NULL) + return NSS_STATUS_NOTFOUND; + p = strcpy (buffer, data->next->val); + data->next = data->next->next; while (isspace (*p)) ++p; - free (result); - + parse_res = _nss_files_parse_rpcent (p, rpc, pdata, buflen); if (!parse_res && errno == ERANGE) return NSS_STATUS_TRYAGAIN; - - free (data->oldkey); - data->oldkey = outkey; - data->oldkeylen = keylen; - data->new_start = 0; } while (!parse_res); - + return NSS_STATUS_SUCCESS; } @@ -179,7 +199,7 @@ enum nss_status _nss_nis_getrpcbyname_r (const char *name, struct rpcent *rpc, char *buffer, size_t buflen) { - intern_t data = {TRUE, NULL, 0}; + intern_t data = {NULL, NULL}; enum nss_status status; int found; diff --git a/nis/nss_nis/nis-service.c b/nis/nss_nis/nis-service.c index 6d07479..46c3364 100644 --- a/nis/nss_nis/nis-service.c +++ b/nis/nss_nis/nis-service.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996. @@ -37,26 +37,75 @@ extern int _nss_files_parse_servent (char *line, struct servent *result, __libc_lock_define_initialized (static, lock) +struct response_t +{ + char *val; + struct response_t *next; +}; + struct intern_t { - bool_t new_start; - char *oldkey; - int oldkeylen; + struct response_t *start; + struct response_t *next; }; typedef struct intern_t intern_t; -static intern_t intern = {TRUE, NULL, 0}; +static intern_t intern = {NULL, NULL}; + +static int +saveit (int instatus, char *inkey, int inkeylen, char *inval, + int invallen, char *indata) +{ + intern_t *intern = (intern_t *)indata; + + if (instatus != YP_TRUE) + return instatus; + + if (inkey && inkeylen > 0 && inval && invallen > 0) + { + if (intern->start == NULL) + { + intern->start = malloc (sizeof (struct response_t)); + intern->next = intern->start; + } + else + { + intern->next->next = malloc (sizeof (struct response_t)); + intern->next = intern->next->next; + } + intern->next->next = NULL; + intern->next->val = malloc (invallen + 1); + strncpy (intern->next->val, inval, invallen); + intern->next->val[invallen] = '\0'; + } + + return 0; +} static enum nss_status -internal_nis_setservent (intern_t * intern) +internal_nis_setservent (intern_t *intern) { - intern->new_start = 1; - if (intern->oldkey != NULL) + char *domainname; + struct ypall_callback ypcb; + + if (yp_get_default_domain (&domainname)) + return NSS_STATUS_UNAVAIL; + + while (intern->start != NULL) { - free (intern->oldkey); - intern->oldkey = NULL; - intern->oldkeylen = 0; + if (intern->start->val != NULL) + free (intern->start->val); + intern->next = intern->start; + intern->start = intern->start->next; + free (intern->next); } + intern->start = NULL; + + ypcb.foreach = saveit; + ypcb.data = (char *)intern; + yp_all(domainname, "services.byname", &ypcb); + intern->next = intern->start; + return NSS_STATUS_SUCCESS; } enum nss_status @@ -76,13 +125,16 @@ _nss_nis_setservent (void) static enum nss_status internal_nis_endservent (intern_t * intern) { - intern->new_start = 1; - if (intern->oldkey != NULL) + while (intern->start != NULL) { - free (intern->oldkey); - intern->oldkey = NULL; - intern->oldkeylen = 0; + if (intern->start->val != NULL) + free (intern->start->val); + intern->next = intern->start; + intern->start = intern->start->next; + free (intern->next); } + intern->start = NULL; + return NSS_STATUS_SUCCESS; } @@ -104,57 +156,25 @@ static enum nss_status internal_nis_getservent_r (struct servent *serv, char *buffer, size_t buflen, intern_t *data) { - char *domain; - char *result; - int len, parse_res; - char *outkey; - int keylen; + int parse_res; char *p; - if (yp_get_default_domain (&domain)) - return NSS_STATUS_UNAVAIL; - + if (data->start == NULL) + internal_nis_setservent (data); + /* Get the next entry until we found a correct one. */ do { - enum nss_status retval; - - if (data->new_start) - retval = yperr2nss (yp_first (domain, "services.byname", - &outkey, &keylen, &result, &len)); - else - retval = yperr2nss ( yp_next (domain, "services.byname", - data->oldkey, data->oldkeylen, - &outkey, &keylen, &result, &len)); - - if (retval != NSS_STATUS_SUCCESS) - { - if (retval == NSS_STATUS_TRYAGAIN) - __set_errno (EAGAIN); - return retval; - } - - if ((size_t) (len + 1) > buflen) - { - free (result); - __set_errno (ERANGE); - return NSS_STATUS_TRYAGAIN; - } - - p = strncpy (buffer, result, len); - buffer[len] = '\0'; + if (data->next == NULL) + return NSS_STATUS_NOTFOUND; + p = strcpy (buffer, data->next->val); + data->next = data->next->next; while (isspace (*p)) ++p; - free (result); - + parse_res = _nss_files_parse_servent (p, serv, buffer, buflen); if (!parse_res && errno == ERANGE) return NSS_STATUS_TRYAGAIN; - - free (data->oldkey); - data->oldkey = outkey; - data->oldkeylen = keylen; - data->new_start = 0; } while (!parse_res); @@ -179,7 +199,7 @@ enum nss_status _nss_nis_getservbyname_r (const char *name, char *protocol, struct servent *serv, char *buffer, size_t buflen) { - intern_t data = {TRUE, NULL, 0}; + intern_t data = {NULL, NULL}; enum nss_status status; int found; @@ -198,15 +218,19 @@ _nss_nis_getservbyname_r (const char *name, char *protocol, ((status = internal_nis_getservent_r (serv, buffer, buflen, &data)) == NSS_STATUS_SUCCESS)) { - if (strcmp (serv->s_name, name) == 0) - { - if (strcmp (serv->s_proto, protocol) == 0) - { - found = 1; - } - } + if (strcmp (serv->s_proto, protocol) == 0) + { + char **cp; + + if (strcmp (serv->s_name, name) == 0) + found = 1; + else + for (cp = serv->s_aliases; *cp; cp++) + if (strcmp(name, *cp) == 0) + found = 1; + } } - + internal_nis_endservent (&data); if (!found && status == NSS_STATUS_SUCCESS) @@ -219,7 +243,7 @@ enum nss_status _nss_nis_getservbyport_r (int port, char *protocol, struct servent *serv, char *buffer, size_t buflen) { - intern_t data = {TRUE, NULL, 0}; + intern_t data = {NULL, NULL}; enum nss_status status; int found; diff --git a/posix/unistd.h b/posix/unistd.h index 57652bf..0a75224 100644 --- a/posix/unistd.h +++ b/posix/unistd.h @@ -171,6 +171,7 @@ extern int access __P ((__const char *__name, int __type)); #ifdef __USE_GNU /* Test for access to NAME using the effective UID and GID (as normal file operations use). */ +extern int __euidaccess __P ((__const char *__name, int __type)); extern int euidaccess __P ((__const char *__name, int __type)); #endif diff --git a/stdlib/Makefile b/stdlib/Makefile index af80c0b..a9e22ac 100644 --- a/stdlib/Makefile +++ b/stdlib/Makefile @@ -21,7 +21,7 @@ # subdir := stdlib -headers := stdlib.h alloca.h monetary.h +headers := stdlib.h alloca.h monetary.h inttypes.h routines := \ atof atoi atol atoll \ diff --git a/sysdeps/alpha/__math.h b/sysdeps/alpha/__math.h index 50d8ac3..0f76027 100644 --- a/sysdeps/alpha/__math.h +++ b/sysdeps/alpha/__math.h @@ -1,22 +1,22 @@ /* Inline math functions for Alpha. -Copyright (C) 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. -Contributed by David Mosberger-Tang. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Mosberger-Tang. -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 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. + 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., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + 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. */ #if defined (__GNUC__) && !defined (__NO_MATH_INLINES) @@ -41,13 +41,4 @@ atan (double __x) return __atan2 (__x, 1.0); } -#ifdef __USE_MISC -extern __inline double -cabs (struct __cabs_complex __z) -{ - extern double __hypot (double, double); - return __hypot(__z.x, __z.y); -} -#endif - #endif diff --git a/sysdeps/generic/socketbits.h b/sysdeps/generic/socketbits.h index db1a0ac..5d85a8e 100644 --- a/sysdeps/generic/socketbits.h +++ b/sysdeps/generic/socketbits.h @@ -50,6 +50,7 @@ enum __socket_type #define PF_UNSPEC 0 /* Unspecified. */ #define PF_LOCAL 1 /* Local to host (pipes and file-domain). */ #define PF_UNIX PF_LOCAL /* Old BSD name for PF_LOCAL. */ +#define PF_FILE PF_LOCAL /* POSIX name for PF_LOCAL. */ #define PF_INET 2 /* IP protocol family. */ #define PF_IMPLINK 3 /* ARPAnet IMP protocol. */ #define PF_PUP 4 /* PUP protocols. */ @@ -82,6 +83,7 @@ enum __socket_type #define AF_UNSPEC PF_UNSPEC #define AF_LOCAL PF_LOCAL #define AF_UNIX PF_UNIX +#define AF_FILE PF_FILE #define AF_INET PF_INET #define AF_IMPLINK PF_IMPLINK #define AF_PUP PF_PUP diff --git a/sysdeps/i386/elf/start.S b/sysdeps/i386/elf/start.S index 53e324b..8b7faae 100644 --- a/sysdeps/i386/elf/start.S +++ b/sysdeps/i386/elf/start.S @@ -73,6 +73,8 @@ nofini: boundary to avoid penalties from misaligned accesses. Thanks to Edward Seidl <seidl@janed.com> for pointing this out. */ andl $0xfffffff8, %esp + pushl %eax /* Push garbage because we allocate + twelve more bytes. */ pushl %eax /* Push third argument: envp. */ pushl %edx /* Push second argument: argv. */ diff --git a/sysdeps/libm-ieee754/s_fpclassify.c b/sysdeps/libm-ieee754/s_fpclassify.c index dd4e742..72a1536 100644 --- a/sysdeps/libm-ieee754/s_fpclassify.c +++ b/sysdeps/libm-ieee754/s_fpclassify.c @@ -29,7 +29,7 @@ __fpclassify (double x) u_int32_t hx, lx; int retval = FP_NORMAL; - GET_WORDS (hx, lx, x); + EXTRACT_WORDS (hx, lx, x); lx |= hx & 0xfffff; hx &= 0x7ff00000; if ((hx | lx) == 0) diff --git a/sysdeps/posix/euidaccess.c b/sysdeps/posix/euidaccess.c index 04648ce..ed59582 100644 --- a/sysdeps/posix/euidaccess.c +++ b/sysdeps/posix/euidaccess.c @@ -1,22 +1,21 @@ -/* euidaccess -- check if effective user id can access file - Copyright (C) 1990, 1991, 1995, 1996 Free Software Foundation, Inc. +/* Check if effective user id can access file + Copyright (C) 1990, 1991, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. -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 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. -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., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + 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. */ /* Written by David MacKenzie and Torbjorn Granlund. Adapted for GNU C library by Roland McGrath. */ @@ -95,6 +94,7 @@ extern int errno; #ifdef _LIBC #define group_member __group_member +#define euidaccess __euidaccess #else @@ -104,6 +104,14 @@ static uid_t uid; /* The user's real group id. */ static gid_t gid; +#ifdef HAVE_GETGROUPS +int group_member (); +#else +#define group_member(gid) 0 +#endif + +#endif + /* The user's effective user id. */ static uid_t euid; @@ -113,14 +121,6 @@ static gid_t egid; /* Nonzero if UID, GID, EUID, and EGID have valid values. */ static int have_ids = 0; -#ifdef HAVE_GETGROUPS -int group_member (); -#else -#define group_member(gid) 0 -#endif - -#endif - /* Return 0 if the user has permission of type MODE on file PATH; otherwise, return -1 and set `errno' to EACCESS. @@ -137,9 +137,6 @@ euidaccess (path, mode) int granted; #ifdef _LIBC - uid_t euid; - gid_t egid; - if (! __libc_enable_secure) /* If we are not set-uid or set-gid, access does the same. */ return access (path, mode); @@ -171,8 +168,12 @@ euidaccess (path, mode) #ifdef _LIBC /* Now we need the IDs. */ - euid = geteuid (); - egid = getegid (); + if (have_ids == 0) + { + have_ids = 1; + euid = geteuid (); + egid = getegid (); + } #endif /* The super-user can read and write any file, and execute any file @@ -192,6 +193,10 @@ euidaccess (path, mode) __set_errno (EACCESS); return -1; } +#undef euidaccess +#ifdef weak_alias +weak_alias (__euidaccess, euidaccess) +#endif #ifdef TEST #include <stdio.h> diff --git a/sysdeps/sparc/configure b/sysdeps/sparc/configure new file mode 100755 index 0000000..5616867 --- /dev/null +++ b/sysdeps/sparc/configure @@ -0,0 +1,4 @@ + # Local configure fragment for sysdeps/sparc. + +# The assembler on SPARC needs the -fPIC flag even when it's assembler code. +ASFLAGS_SO = -fPIC diff --git a/sysdeps/sparc/configure.in b/sysdeps/sparc/configure.in new file mode 100644 index 0000000..3e2b2f0 --- /dev/null +++ b/sysdeps/sparc/configure.in @@ -0,0 +1,6 @@ +sinclude(./aclocal.m4)dnl Autoconf lossage +GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. +# Local configure fragment for sysdeps/sparc. + +# The assembler on SPARC needs the -fPIC flag even when it's assembler code. +ASFLAGS_SO = -fPIC diff --git a/sysdeps/stub/euidaccess.c b/sysdeps/stub/euidaccess.c index 79296a7..f11c74b 100644 --- a/sysdeps/stub/euidaccess.c +++ b/sysdeps/stub/euidaccess.c @@ -1,28 +1,28 @@ /* Test for access to FILE using effective UID and GID. Stub version. -Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. + Copyright (C) 1991, 1995, 1996, 1997 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 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. + 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., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + 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 <errno.h> #include <stddef.h> #include <unistd.h> int -euidaccess (file, type) +__euidaccess (file, type) const char *file; int type; { @@ -35,4 +35,5 @@ euidaccess (file, type) __set_errno (ENOSYS); return -1; } +weak_alias (__euidaccess, euidaccess) stub_warning (euidaccess) diff --git a/sysdeps/unix/sysv/linux/socketbits.h b/sysdeps/unix/sysv/linux/socketbits.h index 915e0f0..38a8fb7 100644 --- a/sysdeps/unix/sysv/linux/socketbits.h +++ b/sysdeps/unix/sysv/linux/socketbits.h @@ -55,6 +55,7 @@ enum __socket_type #define PF_UNSPEC 0 /* Unspecified. */ #define PF_LOCAL 1 /* Local to host (pipes and file-domain). */ #define PF_UNIX PF_LOCAL /* Old BSD name for PF_LOCAL. */ +#define PF_FILE PF_LOCAL /* POSIX name for PF_LOCAL. */ #define PF_INET 2 /* IP protocol family. */ #define PF_AX25 3 /* Amateur Radio AX.25. */ #define PF_IPX 4 /* Novell Internet Protocol. */ @@ -70,6 +71,7 @@ enum __socket_type #define AF_UNSPEC PF_UNSPEC #define AF_LOCAL PF_LOCAL #define AF_UNIX PF_UNIX +#define AF_FILE PF_FILE #define AF_INET PF_INET #define AF_AX25 PF_AX25 #define AF_IPX PF_IPX diff --git a/sysdeps/wordsize-32/inttypes.h b/sysdeps/wordsize-32/inttypes.h new file mode 100644 index 0000000..f9735a1 --- /dev/null +++ b/sysdeps/wordsize-32/inttypes.h @@ -0,0 +1,340 @@ +/* Copyright (C) 1997 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. */ + +/* + * ISO C 9X: 7.4 Integral types <inttypes.h> + */ + +#ifndef _INTTYPES_H +#define _INTTYPES_H 1 + +/* Exact integral types. */ + +/* Signed. */ +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; +typedef long long int int64_t; + +/* Unsigned. */ +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long long int uint64_t; + + +/* Largest integral types. */ +typedef long long int intmax_t; +typedef unsigned long long int uintmax_t; + + +/* Types for `void *' pointers. */ +typedef int intptr_t; +typedef unsigned int uintptr_t; + + +/* Efficient types. */ +typedef int intfast_t; +typedef unsigned int uintfast_t; + + +/* Small types. */ + +/* Signed. */ +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; +typedef long long int int_least64_t; + +/* Unsigned. */ +typedef unsigned char int_least8_t; +typedef unsigned short int int_least16_t; +typedef unsigned int int_least32_t; +typedef unsigned long long int int_least64_t; + + +/* Fast types. */ + +/* Signed. */ +typedef signed char int_fast8_t; +typedef int int_fast16_t; +typedef int int_fast32_t; +typedef long long int int_fast64_t; + +/* Unsigned. */ +typedef unsigned char int_fast8_t; +typedef unsigned int int_fast16_t; +typedef unsigned int int_fast32_t; +typedef unsigned long long int int_fast64_t; + + +/* Limits of integral types. */ + +/* Minimum of signed integral types. */ +#define INT8_MIN (-128) +#define INT16_MIN (-32767-1) +#define INT32_MIN (-2147483647-1) +#define INT64_MIN (-9223372036854775807LL-1) +/* Maximum of signed integral types. */ +#define INT8_MAX (127) +#define INT16_MAX (32767) +#define INT32_MAX (2147483647) +#define INT64_MAX (9223372036854775807LL) + +/* Maximum of unsigned integral types. */ +#define UINT8_MAX (255U) +#define UINT16_MAX (65535U) +#define UINT32_MAX (4294967295U) +#define UINT64_MAX (18446744073709551615uLL) + + +/* Minimum of signed integral types having a minimum size. */ +#define INT_LEAST8_MIN (-128) +#define INT_LEAST16_MIN (-32767-1) +#define INT_LEAST32_MIN (-2147483647-1) +#define INT_LEAST64_MIN (-9223372036854775807LL-1) +/* Maximum of signed integral types having a minimum size. */ +#define INT_LEAST8_MAX (127) +#define INT_LEAST16_MAX (32767) +#define INT_LEAST32_MAX (2147483647) +#define INT_LEAST64_MAX (9223372036854775807LL) + +/* Maximum of unsigned integral types having a minimum size. */ +#define UINT_LEAST8_MAX (255U) +#define UINT_LEAST16_MAX (65535U) +#define UINT_LEAST32_MAX (4294967295U) +#define UINT_LEAST64_MAX (18446744073709551615uLL) + + +/* Minimum of fast signed integral types having a minimum size. */ +#define INT_LEAST8_MIN (-128) +#define INT_LEAST16_MIN (-2147483647-1) +#define INT_LEAST32_MIN (-2147483647-1) +#define INT_LEAST64_MIN (-9223372036854775807LL-1) +/* Maximum of fast signed integral types having a minimum size. */ +#define INT_LEAST8_MAX (127) +#define INT_LEAST16_MAX (2147483647) +#define INT_LEAST32_MAX (2147483647) +#define INT_LEAST64_MAX (9223372036854775807LL) + +/* Maximum of fast unsigned integral types having a minimum size. */ +#define UINT_LEAST8_MAX (255U) +#define UINT_LEAST16_MAX (4294967295U) +#define UINT_LEAST32_MAX (4294967295U) +#define UINT_LEAST64_MAX (18446744073709551615uLL) + + +/* Minimum for most efficient signed integral types. */ +#define INTFAST_MIN (-128) +/* Maximum for most efficient signed integral types. */ +#define INTFAST_MAX (127) + +/* Maximum for most efficient unsigned integral types. */ +#define UINTFAST_MAX (255) + + +/* Minimum for largest signed integral type. */ +#define INTMAX_MIN (-9223372036854775807LL-1) +/* Maximum for largest signed integral type. */ +#define INTMAX_MAX (9223372036854775807LL) + +/* Maximum for largest unsigned integral type. */ +#define UINTMAX_MAX (18446744073709551615uLL) + + +/* Values to test for integral types holding `void *' pointer. */ +#define INTPTR_MAX (2147483647) +#define UINTPTR_MAX (4294967295U) + + +/* Macros for creating constants. */ +#define __CONCAT__(A, B) A ## B + +/* Signed. */ +#define INT8_C(c) ((int8_t) c) +#define INT16_C(c) ((int16_t) c) +#define INT32_C(c) ((int32_t) c) +#define INT64_C(c) ((int64_t) __CONCAT__ (c,ll)) + +/* Unsigned. */ +#define UINT8_C(c) ((uint8_t) __CONCAT__ (c,u)) +#define UINT16_C(c) ((uint16_t) __CONCAT__ (c,u)) +#define UINT32_C(c) ((uint32_t) __CONCAT__ (c,u)) +#define UINT64_C(c) ((uint64_t) __CONCAT__ (c,ull)) + +/* Maximal type. */ +#define INTMAX_C(c) ((intmax_t) __CONCAT__ (c,ll)) +#define UINTMAX_C(c) ((uintmax_t) __CONCAT__ (c,ull)) + + +/* Macros for printing format specifiers. */ + +/* Decimal notation. */ +#define PRId8 "d" +#define PRId16 "d" +#define PRId32 "d" +#define PRId64 "lld" + +#define PRIdLEAST8 "d" +#define PRIdLEAST16 "d" +#define PRIdLEAST32 "d" +#define PRIdLEAST64 "lld" + +#define PRIdFAST8 "d" +#define PRIdFAST16 "d" +#define PRIdFAST32 "d" +#define PRIdFAST64 "lld" + + +#define PRIi8 "i" +#define PRIi16 "i" +#define PRIi32 "i" +#define PRIi64 "lli" + +#define PRIiLEAST8 "i" +#define PRIiLEAST16 "i" +#define PRIiLEAST32 "i" +#define PRIiLEAST64 "lli" + +#define PRIiFAST8 "i" +#define PRIiFAST16 "i" +#define PRIiFAST32 "i" +#define PRIiFAST64 "lli" + +/* Octal notation. */ +#define PRIo8 "o" +#define PRIo16 "o" +#define PRIo32 "o" +#define PRIo64 "llo" + +#define PRIoLEAST8 "o" +#define PRIoLEAST16 "o" +#define PRIoLEAST32 "o" +#define PRIoLEAST64 "llo" + +#define PRIoFAST8 "o" +#define PRIoFAST16 "o" +#define PRIoFAST32 "o" +#define PRIoFAST64 "llo" + +/* lowercase hexadecimal notation. */ +#define PRIx8 "x" +#define PRIx16 "x" +#define PRIx32 "x" +#define PRIx64 "llx" + +#define PRIxLEAST8 "x" +#define PRIxLEAST16 "x" +#define PRIxLEAST32 "x" +#define PRIxLEAST64 "llx" + +#define PRIxFAST8 "x" +#define PRIxFAST16 "x" +#define PRIxFAST32 "x" +#define PRIxFAST64 "llx" + +/* UPPERCASE hexadecimal notation. */ +#define PRIX8 "X" +#define PRIX16 "X" +#define PRIX32 "X" +#define PRIX64 "llX" + +#define PRIXLEAST8 "X" +#define PRIXLEAST16 "X" +#define PRIXLEAST32 "X" +#define PRIXLEAST64 "llX" + +#define PRIXFAST8 "X" +#define PRIXFAST16 "X" +#define PRIXFAST32 "X" +#define PRIXFAST64 "llX" + + +/* Unsigned integers. */ +#define PRIu8 "u" +#define PRIu16 "u" +#define PRIu32 "u" +#define PRIu64 "llu" + +#define PRIuLEAST8 "u" +#define PRIuLEAST16 "u" +#define PRIuLEAST32 "u" +#define PRIuLEAST64 "llu" + +#define PRIuFAST8 "u" +#define PRIuFAST16 "u" +#define PRIuFAST32 "u" +#define PRIuFAST64 "llu" + + +/* Macros for printing `intmax_t' and `uintmax_t'. */ +#define PRIdMAX "lld" +#define PRIoMAX "llo" +#define PRIxMAX "llx" +#define PRIuMAX "llu" + + +/* Macros for printing `intfast_t' and `uintfast_t'. */ +#define PRIdFAST "d" +#define PRIoFAST "o" +#define PRIxFAST "x" +#define PRIuFAST "u" + + +/* Macros for printing `intptr_t' and `uintptr_t'. */ +#define PRIdPTR "d" +#define PRIoPTR "o" +#define PRIxPTR "x" +#define PRIuPTR "u" + + +/* Macros for printing format specifiers. */ + +/* Decimal notation. */ +#define SCNd16 "hd" +#define SCNd32 "d" +#define SCNd64 "lld" + +#define SCNi16 "hi" +#define SCNi32 "i" +#define SCNi64 "lli" + +/* Octal notation. */ +#define SCNo16 "ho" +#define SCNo32 "o" +#define SCNo64 "llo" + +/* Hexadecimal notation. */ +#define SCNx16 "hx" +#define SCNx32 "x" +#define SCNx64 "llx" + + +/* Macros for scaning `intfast_t' and `uintfast_t'. */ +#define SCNdFAST "d" +#define SCNiFAST "i" +#define SCNoFAST "o" +#define SCNxFAST "x" + +/* Macros for scaning `intptr_t' and `uintptr_t'. */ +#define SCNdPTR "d" +#define SCNiPTR "i" +#define SCNoPTR "o" +#define SCNxPTR "x" + +#endif /* inttypes.h */ diff --git a/sysdeps/wordsize-64/inttypes.h b/sysdeps/wordsize-64/inttypes.h new file mode 100644 index 0000000..a86e49c --- /dev/null +++ b/sysdeps/wordsize-64/inttypes.h @@ -0,0 +1,340 @@ +/* Copyright (C) 1997 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. */ + +/* + * ISO C 9X: 7.4 Integral types <inttypes.h> + */ + +#ifndef _INTTYPES_H +#define _INTTYPES_H 1 + +/* Exact integral types. */ + +/* Signed. */ +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; +typedef long int int64_t; + +/* Unsigned. */ +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long int uint64_t; + + +/* Largest integral types. */ +typedef long long int intmax_t; +typedef unsigned long int uintmax_t; + + +/* Types for `void *' pointers. */ +typedef long int intptr_t; +typedef unsigned long int uintptr_t; + + +/* Efficient types. */ +typedef long int intfast_t; +typedef unsigned long int uintfast_t; + + +/* Small types. */ + +/* Signed. */ +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; +typedef long int int_least64_t; + +/* Unsigned. */ +typedef unsigned char int_least8_t; +typedef unsigned short int int_least16_t; +typedef unsigned int int_least32_t; +typedef unsigned long int int_least64_t; + + +/* Fast types. */ + +/* Signed. */ +typedef signed char int_fast8_t; +typedef int int_fast16_t; +typedef int int_fast32_t; +typedef long int int_fast64_t; + +/* Unsigned. */ +typedef unsigned char int_fast8_t; +typedef unsigned int int_fast16_t; +typedef unsigned int int_fast32_t; +typedef unsigned long int int_fast64_t; + + +/* Limits of integral types. */ + +/* Minimum of signed integral types. */ +#define INT8_MIN (-128) +#define INT16_MIN (-32767-1) +#define INT32_MIN (-2147483647-1) +#define INT64_MIN (-9223372036854775807L-1) +/* Maximum of signed integral types. */ +#define INT8_MAX (127) +#define INT16_MAX (32767) +#define INT32_MAX (2147483647) +#define INT64_MAX (9223372036854775807L) + +/* Maximum of unsigned integral types. */ +#define UINT8_MAX (255U) +#define UINT16_MAX (65535U) +#define UINT32_MAX (4294967295U) +#define UINT64_MAX (18446744073709551615uL) + + +/* Minimum of signed integral types having a minimum size. */ +#define INT_LEAST8_MIN (-128) +#define INT_LEAST16_MIN (-32767-1) +#define INT_LEAST32_MIN (-2147483647-1) +#define INT_LEAST64_MIN (-9223372036854775807L-1) +/* Maximum of signed integral types having a minimum size. */ +#define INT_LEAST8_MAX (127) +#define INT_LEAST16_MAX (32767) +#define INT_LEAST32_MAX (2147483647) +#define INT_LEAST64_MAX (9223372036854775807L) + +/* Maximum of unsigned integral types having a minimum size. */ +#define UINT_LEAST8_MAX (255U) +#define UINT_LEAST16_MAX (65535U) +#define UINT_LEAST32_MAX (4294967295U) +#define UINT_LEAST64_MAX (18446744073709551615uL) + + +/* Minimum of fast signed integral types having a minimum size. */ +#define INT_LEAST8_MIN (-128) +#define INT_LEAST16_MIN (-2147483647-1) +#define INT_LEAST32_MIN (-2147483647-1) +#define INT_LEAST64_MIN (-9223372036854775807L-1) +/* Maximum of fast signed integral types having a minimum size. */ +#define INT_LEAST8_MAX (127) +#define INT_LEAST16_MAX (2147483647) +#define INT_LEAST32_MAX (2147483647) +#define INT_LEAST64_MAX (9223372036854775807L) + +/* Maximum of fast unsigned integral types having a minimum size. */ +#define UINT_LEAST8_MAX (255U) +#define UINT_LEAST16_MAX (4294967295U) +#define UINT_LEAST32_MAX (4294967295U) +#define UINT_LEAST64_MAX (18446744073709551615uL) + + +/* Minimum for most efficient signed integral types. */ +#define INTFAST_MIN (-128) +/* Maximum for most efficient signed integral types. */ +#define INTFAST_MAX (127) + +/* Maximum for most efficient unsigned integral types. */ +#define UINTFAST_MAX (255) + + +/* Minimum for largest signed integral type. */ +#define INTMAX_MIN (-9223372036854775807L-1) +/* Maximum for largest signed integral type. */ +#define INTMAX_MAX (9223372036854775807L) + +/* Maximum for largest unsigned integral type. */ +#define UINTMAX_MAX (18446744073709551615uL) + + +/* Values to test for integral types holding `void *' pointer. */ +#define INTPTR_MAX (9223372036854775807L) +#define UINTPTR_MAX (18446744073709551615uL) + + +/* Macros for creating constants. */ +#define __CONCAT__(A, B) A ## B + +/* Signed. */ +#define INT8_C(c) ((int8_t) c) +#define INT16_C(c) ((int16_t) c) +#define INT32_C(c) ((int32_t) c) +#define INT64_C(c) ((int64_t) __CONCAT__ (c,l)) + +/* Unsigned. */ +#define UINT8_C(c) ((uint8_t) __CONCAT__ (c,u)) +#define UINT16_C(c) ((uint16_t) __CONCAT__ (c,u)) +#define UINT32_C(c) ((uint32_t) __CONCAT__ (c,u)) +#define UINT64_C(c) ((uint64_t) __CONCAT__ (c,ul)) + +/* Maximal type. */ +#define INTMAX_C(c) ((intmax_t) __CONCAT__ (c,ll)) +#define UINTMAX_C(c) ((uintmax_t) __CONCAT__ (c,ul)) + + +/* Macros for printing format specifiers. */ + +/* Decimal notation. */ +#define PRId8 "d" +#define PRId16 "d" +#define PRId32 "d" +#define PRId64 "ld" + +#define PRIdLEAST8 "d" +#define PRIdLEAST16 "d" +#define PRIdLEAST32 "d" +#define PRIdLEAST64 "ld" + +#define PRIdFAST8 "d" +#define PRIdFAST16 "d" +#define PRIdFAST32 "d" +#define PRIdFAST64 "ld" + + +#define PRIi8 "i" +#define PRIi16 "i" +#define PRIi32 "i" +#define PRIi64 "li" + +#define PRIiLEAST8 "i" +#define PRIiLEAST16 "i" +#define PRIiLEAST32 "i" +#define PRIiLEAST64 "li" + +#define PRIiFAST8 "i" +#define PRIiFAST16 "i" +#define PRIiFAST32 "i" +#define PRIiFAST64 "li" + +/* Octal notation. */ +#define PRIo8 "o" +#define PRIo16 "o" +#define PRIo32 "o" +#define PRIo64 "lo" + +#define PRIoLEAST8 "o" +#define PRIoLEAST16 "o" +#define PRIoLEAST32 "o" +#define PRIoLEAST64 "lo" + +#define PRIoFAST8 "o" +#define PRIoFAST16 "o" +#define PRIoFAST32 "o" +#define PRIoFAST64 "lo" + +/* lowercase hexadecimal notation. */ +#define PRIx8 "x" +#define PRIx16 "x" +#define PRIx32 "x" +#define PRIx64 "lx" + +#define PRIxLEAST8 "x" +#define PRIxLEAST16 "x" +#define PRIxLEAST32 "x" +#define PRIxLEAST64 "lx" + +#define PRIxFAST8 "x" +#define PRIxFAST16 "x" +#define PRIxFAST32 "x" +#define PRIxFAST64 "lx" + +/* UPPERCASE hexadecimal notation. */ +#define PRIX8 "X" +#define PRIX16 "X" +#define PRIX32 "X" +#define PRIX64 "lX" + +#define PRIXLEAST8 "X" +#define PRIXLEAST16 "X" +#define PRIXLEAST32 "X" +#define PRIXLEAST64 "lX" + +#define PRIXFAST8 "X" +#define PRIXFAST16 "X" +#define PRIXFAST32 "X" +#define PRIXFAST64 "lX" + + +/* Unsigned integers. */ +#define PRIu8 "u" +#define PRIu16 "u" +#define PRIu32 "u" +#define PRIu64 "lu" + +#define PRIuLEAST8 "u" +#define PRIuLEAST16 "u" +#define PRIuLEAST32 "u" +#define PRIuLEAST64 "lu" + +#define PRIuFAST8 "u" +#define PRIuFAST16 "u" +#define PRIuFAST32 "u" +#define PRIuFAST64 "lu" + + +/* Macros for printing `intmax_t' and `uintmax_t'. */ +#define PRIdMAX "ld" +#define PRIoMAX "lo" +#define PRIxMAX "lx" +#define PRIuMAX "lu" + + +/* Macros for printing `intfast_t' and `uintfast_t'. */ +#define PRIdFAST "d" +#define PRIoFAST "o" +#define PRIxFAST "x" +#define PRIuFAST "u" + + +/* Macros for printing `intptr_t' and `uintptr_t'. */ +#define PRIdPTR "ld" +#define PRIoPTR "lo" +#define PRIxPTR "lx" +#define PRIuPTR "lu" + + +/* Macros for printing format specifiers. */ + +/* Decimal notation. */ +#define SCNd16 "hd" +#define SCNd32 "d" +#define SCNd64 "ld" + +#define SCNi16 "hi" +#define SCNi32 "i" +#define SCNi64 "li" + +/* Octal notation. */ +#define SCNo16 "ho" +#define SCNo32 "o" +#define SCNo64 "lo" + +/* Hexadecimal notation. */ +#define SCNx16 "hx" +#define SCNx32 "x" +#define SCNx64 "lx" + + +/* Macros for scaning `intfast_t' and `uintfast_t'. */ +#define SCNdFAST "d" +#define SCNiFAST "i" +#define SCNoFAST "o" +#define SCNxFAST "x" + +/* Macros for scaning `intptr_t' and `uintptr_t'. */ +#define SCNdPTR "ld" +#define SCNiPTR "li" +#define SCNoPTR "lo" +#define SCNxPTR "lx" + +#endif /* inttypes.h */ diff --git a/time/Makefile b/time/Makefile index 044f154..cf0ac6a 100644 --- a/time/Makefile +++ b/time/Makefile @@ -179,14 +179,20 @@ CFLAGS-tzset.c = $(tz-cflags) # We have to make sure the data for testing the tz functions is available. .PHONY: install-test-data -install-test-data: northamerica $(objpfx)zic $(leapseconds) yearistype \ - etcetera simplebackw +install-test-data: $(addprefx $(objpfx)testdata/, America/New_York \ + Etc/UTC UTC) + +$(objpfx)testdata/America/New_York: $(objpfx)zic $(leapseconds) yearistype $(built-program-cmd) -d $(objpfx)testdata -L $(leapseconds) \ -y yearistype northamerica +$(objpfx)testdata/Etc/UTC: $(objpfx)zic $(leapseconds) yearistype $(built-program-cmd) -d $(objpfx)testdata -L $(leapseconds) \ -y yearistype etcetera +$(objpfx)testdata/UTC: $(objpfx)testdata/Etc/UTC $(objpfx)zic \ + $(leapseconds) yearistype $(built-program-cmd) -d $(objpfx)testdata -L $(leapseconds) \ -y yearistype simplebackw + test-tz-ENV = TZDIR=$(objpfx)testdata diff --git a/time/private.h b/time/private.h index 5a5b516..5502aa8 100644 --- a/time/private.h +++ b/time/private.h @@ -176,14 +176,13 @@ extern int errno; ** Private function declarations. */ char * icalloc P((int nelem, int elsize)); -char * icatalloc P((char * old, const char * new)); -char * icpyalloc P((const char * string)); -char * imalloc P((int n)); -void * irealloc P((void * pointer, int size)); -void icfree P((char * pointer)); -void ifree P((char * pointer)); -char * scheck P((const char *string, char *format)); - +char * icatalloc P((char * old, const char * const new)); +char * icpyalloc P((const char * const string)); +char * imalloc P((const int n)); +void * irealloc P((void * const pointer, const int size)); +void icfree P((char * const pointer)); +void ifree P((char * const pointer)); +char * scheck P((const char * const string, const char * const format)); /* ** Finally, some convenience items. diff --git a/time/scheck.c b/time/scheck.c index b51f58d..52b4ff5 100644 --- a/time/scheck.c +++ b/time/scheck.c @@ -11,7 +11,7 @@ static char elsieid[] = "@(#)scheck.c 8.14"; char * scheck(string, format) const char * const string; -char * const format; +const char * const format; { register char * fbuf; register const char * fp; |