+Thu Dec 12 03:32:21 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * libio/_G_config.h: Add definition of _G_int16_t, _G_int32_t,
+ _G_uint16_t, _G_uin32_t, _G_HAVE_BOOL, _G_HAVE_MMAP, and
+ _G_ARGS.
+
+ Change libio buffer handling to allocate internal buffers using
+ mmap if possible.
+ * libio/filedoalloc.c (_IO_file_doallocate): Change call to
+ ALLOC_BUF.
+ * libio/genops.c (_IO_setb, _IO_default_finish): Change call
+ to FREE_BUF.
+ (_IO_default_doallocate): Change call to ALLOC_BUF.
+ * libio/libioP.h: Change definition of ALLOC_BUF and FREE_BUF
+ to use mmap/munmap when possible.
+ * libio/memstream.c: Don't use ALLOC_BUF, but directly malloc.
+ * libio/vasprintf.c: Likewise.
+ Patch by HJ Lu.
+
+ * libio/libio.h: Define NULL as __null only for gcc-2.8 and up.
+ * libio/libioP.h: Likewise.
+
+ * libio/fileops.c (_IO_file_read, _IO_file_write): Don't
+ restart syscall when EINTR was returned. Necessary for POSIX.1.
+
+ * libio/strops.c (_IO_str_overflow): Add cast to prevent warning.
+
+ * new-malloc/malloc.c (heap_trim): Correctly place parentheses to
+ prevent warnings.
+
+ * nis/Makefile: Remove rules for bsd-tools which are not part
+ of glibc.
+ Patch by Thorsten Kukuk.
+
+ * nis/ypclnt.c: Add prototype for xdr_free.
+ Add const to first parameter for __yp_bind.
+ * nis/nss_compat/compat-pwd.c (getpwent_next_netgr, getpwent_next_nis,
+ getpwent_next_file): Variable `p2len' must have type size_t.
+ * nis/nss_nis/nis-alias.c: Add casts to prevent warnings.
+ * nis/nss_nis/nis-ethers.c: Likewise.
+ * nis/nss_nis/nis-grp.c: Likewise.
+ * nis/nss_nis/nis-hosts.c: Likewise.
+ * nis/nss_nis/nis-network.c: Likewise.
+ * nis/nss_nis/nis-proto.c: Likewise.
+ * nis/nss_nis/nis-pwd.c: Likewise.
+ * nis/nss_nis/nis-rpc.c: Likewise.
+ * nis/nss_nis/nis-service.c: Likewise.
+ * nis/nss_nis/nis-spwd.c: Likewise.
+
+ * nis/rpcsvc/yp_prot.h (ypreq_key): Change type of members to
+ `const char *'.
+ (ypmaplist): Change member names to `map' and `next' and provide
+ #defines for old names.
+ Patch by Thorsten Kukuk.
+
+ * nss/nss_files/files-parse.c (parse_line, parse_list): Change
+ type for `datalen' parameter to size_t.
+
+ * shsdow/lckpwdf.c: Use fcntl forlocking, not flock.
+
+ * stdio-common/printf.c [USE_IN_LIBIO]: Provide alias _IO_printf
+ for printf.
+ * stdio-common/sscanf.c [USE_IN_LIBIO]: Provide alias _IO_sscanf
+ for sscanf.
+ Patch by HJ Lu.
+
+ * stdio-common/tmpfile.c: Update copyright.
+
+ * stdio-common/vfscanf.c: Correctly handle EINTR error from fgetc
+ function.
+ Don't eat white space for `C' format.
+
+ * stdlib/tst-strtol.c [~0UL != 0xffffffff]: Fix typo in test data.
+
+ * sysdeps/generic/abort.c: Update copyright. De-ANSI-declfy.
+ * sysdeps/i386/abort.c: Removed. This version does not use
+ signal SIGABRT.
+
+ * sysdeps/i386/fpu/__math.h: Define __NO_MATH_INLINES if not using
+ gcc-2.8 or up.
+ Patch by HJ Lu.
+
+ * sysdeps/posix/tempname.c: Test for error but EEXIST after open
+ call. If EMFILE, ENFILE, or EINTR return with error.
+
+Wed Dec 11 14:43:52 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * gnu-versions.h: Set _GNU_OBSTACK_INTERFACE_VERSION back to 1.
+ We are compatible again.
+ * new-malloc/obstack.h (struct obstack): Add back alloc_failed bit
+ even though it is not used.
+ * malloc/obstack.h: Likewise.
+ * new-malloc/obstack.c (_obstack_begin, _obstack_begin_1): Initialize
+ alloc_failed bit to 0.
+
+ * time/strftime.c: Extend for Emacs' needs. Recognize field width,
+ %P format and `0' modifier.
+
+Tue Dec 10 21:20:44 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * Makerules (make-link): Don't discard exit codes of intermediate
+ commands. Always use rellns-sh if symbolic links are available.
+
+Tue Dec 10 20:09:51 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * sysdeps/unix/sysv/linux/netinet/in.h: Enclose #include
+ <linux/in.h> in __BEGIN_DECLS/__END_DECLS to avoid linkage
+ conflict of ntohs etc. in <asm/byteorder.h>.
+
Wed Dec 11 01:04:30 1996 Ulrich Drepper <drepper@cygnus.com>
Add NIS NSS implementation.
ifneq ($(findstring -s,$(LN_S)),)
define make-link
-rm -f $@.new; \
-if test '$(@D)' = '$(<D)'; then \
- (cd $(@D); $(LN_S) $(<F) $(@F).new); \
-else \
- $(SHELL) $(..)rellns-sh $< $@.new; \
-fi; \
+rm -f $@.new
+$(SHELL) $(..)rellns-sh $< $@.new
mv -f $@.new $@
endef
else
# If we have no symbolic links don't bother with rellns-sh.
define make-link
-rm -f $@.new; \
-$(LN_S) $< $@.new; \
+rm -f $@.new
+$(LN_S) $< $@.new
mv -f $@.new $@
endef
endif
remember, if any of these versions change, the libc.so major version
number must change too (so avoid it)! */
-#define _GNU_OBSTACK_INTERFACE_VERSION 2 /* vs malloc/obstack.c */
+#define _GNU_OBSTACK_INTERFACE_VERSION 1 /* vs malloc/obstack.c */
#define _GNU_REGEX_INTERFACE_VERSION 1 /* vs posix/regex.c */
#define _GNU_GLOB_INTERFACE_VERSION 1 /* vs posix/glob.c */
#define _G_pid_t __pid_t
#define _G_uid_t __uid_t
+typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
+typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
+typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
+typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
+
+#define _G_HAVE_BOOL 1
+
/* These library features are always available in the GNU C library. */
#define _G_HAVE_ATEXIT 1
#define _G_va_list __gnuc_va_list
#define _G_HAVE_PRINTF_FP 1
+#define _G_HAVE_MMAP 1
/* This is defined by <statbuf.h> if `st_blksize' exists. */
#define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE)
#define _G_VTABLE_LABEL_HAS_LENGTH 1
+#if defined (__cplusplus) || defined (__STDC__)
+#define _G_ARGS(ARGLIST) ARGLIST
+#else
+#define _G_ARGS(ARGLIST) ()
+#endif
+
#endif /* _G_config.h */
size = _IO_BUFSIZ;
#endif
}
- p = ALLOC_BUF(size);
- if (p == NULL)
- return EOF;
+ ALLOC_BUF(p, size, EOF);
_IO_setb(fp, p, p+size, 1);
if (couldbetty && __isatty (fp->_fileno))
fp->_flags |= _IO_LINE_BUF;
for (;;)
{
_IO_ssize_t count = _IO_read(fp->_fileno, buf, size);
-#ifdef EINTR
+#if 0 && defined EINTR
if (count == -1 && errno == EINTR)
continue;
#endif
_IO_ssize_t count = _IO_write(f->_fileno, data, to_do);
if (count == EOF)
{
-#ifdef EINTR
+#if 0 && defined EINTR
if (errno == EINTR)
continue;
else
_IO_FILE *f AND char *b AND char *eb AND int a)
{
if (f->_IO_buf_base && !(f->_flags & _IO_USER_BUF))
- FREE_BUF(f->_IO_buf_base);
+ FREE_BUF(f->_IO_buf_base, _IO_blen (f));
f->_IO_buf_base = b;
f->_IO_buf_end = eb;
if (a)
DEFUN(_IO_default_doallocate, (fp),
_IO_FILE *fp)
{
- char *buf = ALLOC_BUF(_IO_BUFSIZ);
- if (buf == NULL)
- return EOF;
+ char *buf;
+
+ ALLOC_BUF(buf, _IO_BUFSIZ, EOF);
_IO_setb(fp, buf, buf+_IO_BUFSIZ, 1);
return 1;
}
struct _IO_marker *mark;
if (fp->_IO_buf_base && !(fp->_flags & _IO_USER_BUF))
{
- FREE_BUF(fp->_IO_buf_base);
+ FREE_BUF(fp->_IO_buf_base, _IO_blen (fp));
fp->_IO_buf_base = fp->_IO_buf_end = NULL;
}
#define EOF (-1)
#endif
#ifndef NULL
-#ifdef __GNUG__
+#if defined __GNUG__ && \
+ (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
#define NULL (__null)
#else
#if !defined(__cplusplus)
#define EOF (-1)
#endif
#ifndef NULL
-#ifdef __GNUG__
+#if defined __GNUG__ && \
+ (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
#define NULL (__null)
#else
#if !defined(__cplusplus)
#endif
#endif
-#define FREE_BUF(_B) free(_B)
-#define ALLOC_BUF(_S) (char*)malloc(_S)
+#if _G_HAVE_MMAP
+
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <sys/param.h>
+
+#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+
+#if !defined(MAP_ANONYMOUS) || !defined(EXEC_PAGESIZE)
+#undef _G_HAVE_MMAP
+#define _G_HAVE_MMAP 0
+#endif
+
+#endif /* _G_HAVE_MMAP */
+
+#if _G_HAVE_MMAP
+
+#define ROUND_TO_PAGE(_S) \
+ (((_S) + EXEC_PAGESIZE - 1) & ~(EXEC_PAGESIZE - 1))
+
+#define FREE_BUF(_B, _S) \
+ munmap ((_B), ROUND_TO_PAGE (_S))
+#define ALLOC_BUF(_B, _S, _R) \
+ do { \
+ (_B) = (char *) mmap (0, ROUND_TO_PAGE (_S), \
+ PROT_READ | PROT_WRITE, \
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); \
+ if ((_B) == (char *) -1) \
+ return (_R); \
+ } while (0)
+
+#else /* _G_HAVE_MMAP */
+
+#define FREE_BUF(_B, _S) \
+ free(_B)
+#define ALLOC_BUF(_B, _S, _R) \
+ do { \
+ (_B) = (char*)malloc(_S); \
+ if ((_B) == NULL) \
+ return (_R); \
+ } while (0)
+
+#endif /* _G_HAVE_MMAP */
#ifndef OS_FSTAT
#define OS_FSTAT fstat
new_f->fp._sf._sbf._f._lock = &new_f->lock;
#endif
- buf = ALLOC_BUF (_IO_BUFSIZ);
+ buf = malloc (_IO_BUFSIZ);
+ if (buf == NULL)
+ return NULL;
_IO_init (&new_f->fp._sf._sbf._f, 0);
_IO_JUMPS (&new_f->fp._sf._sbf._f) = &_IO_mem_jumps;
_IO_str_init_static (&new_f->fp._sf._sbf._f, buf, _IO_BUFSIZ, buf);
fp->_IO_read_ptr = fp->_IO_read_end;
}
pos = fp->_IO_write_ptr - fp->_IO_write_base;
- if (pos >= _IO_blen(fp) + flush_only)
+ if (pos >= (_IO_size_t) (_IO_blen(fp) + flush_only))
{
if (fp->_flags & _IO_USER_BUF) /* not allowed to enlarge */
return EOF;
_IO_lock_t lock;
#endif
int ret;
- string = ALLOC_BUF(init_string_size);
+ string = malloc (init_string_size);
if (string == NULL)
return -1;
#ifdef _IO_MTSAFE_IO
_IO_JUMPS((_IO_FILE*)&sf) = &_IO_str_jumps;
_IO_str_init_static ((_IO_FILE*)&sf, string, init_string_size, string);
sf._sbf._f._flags &= ~_IO_USER_BUF;
- sf._s._allocate_buffer = (_IO_alloc_type)malloc;
- sf._s._free_buffer = (_IO_free_type)free;
+ sf._s._allocate_buffer = (_IO_alloc_type) malloc;
+ sf._s._free_buffer = (_IO_free_type) free;
ret = _IO_vfprintf((_IO_FILE*)&sf, format, args);
if (ret < 0)
return ret;
- *result_ptr = (char*)realloc(sf._sbf._f._IO_buf_base,
- (sf._sbf._f._IO_write_ptr - sf._sbf._f._IO_write_base) +1);
+ *result_ptr = (char *) realloc (sf._sbf._f._IO_buf_base,
+ (sf._sbf._f._IO_write_ptr
+ - sf._sbf._f._IO_write_base) +1);
if (*result_ptr == NULL)
*result_ptr = sf._sbf._f._IO_buf_base;
(*result_ptr)[sf._sbf._f._IO_write_ptr-sf._sbf._f._IO_write_base] = '\0';
assert(p->size == (0|PREV_INUSE)); /* must be fencepost */
p = prev_chunk(p);
new_size = chunksize(p) + (MINSIZE-2*SIZE_SZ);
- assert(new_size>0 && new_size<(long)2*MINSIZE);
+ assert(new_size>0 && new_size<(long int)(2*MINSIZE));
if(!prev_inuse(p))
new_size += p->prev_size;
assert(new_size>0 && new_size<HEAP_MAX_SIZE);
/* NOTE BEFORE MODIFYING THIS FILE: This version number must be
incremented whenever callers compiled using an old obstack.h can no
longer properly call the functions in this obstack.c. */
-#define OBSTACK_INTERFACE_VERSION 2
+#define OBSTACK_INTERFACE_VERSION 1
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself, and the installed library
chunk->prev = 0;
/* The initial chunk now contains no empty object. */
h->maybe_empty_object = 0;
+ h->alloc_failed = 0;
return 1;
}
chunk->prev = 0;
/* The initial chunk now contains no empty object. */
h->maybe_empty_object = 0;
+ h->alloc_failed = 0;
return 1;
}
chunk contains a zero-length object. This
prevents freeing the chunk if we allocate
a bigger chunk to replace it. */
+ unsigned alloc_failed:1; /* No longer used, as we now call the failed
+ handler on error, but retained for binary
+ compatibility. */
};
/* Declare the external functions we use; they are in obstack.c. */
# the `lib' pass, because they depend on libc.so being built already.
extra-libs-others = $(extra-libs)
-others = ypcat ypmatch yppoll ypset ypwhich
-install-bin = ypcat ypmatch ypwhich
-install-sbin = ypset yppoll
-
# The sources are found in the appropriate subdir.
-subdir-dirs = bsd-tools $(services:%=nss_%)
+subdir-dirs = $(services:%=nss_%)
vpath %.c $(subdir-dirs)
libnsl-routines = yp_xdr ypclnt ypupdate_xdr
CFLAGS-nis-rpc.c = -Wno-strict-prototypes
CFLAGS-nis-service.c = -Wno-strict-prototypes
CFLAGS-nis-spwd.c = -Wno-strict-prototypes
-CFLAGS-ypclnt.c = -Wno-strict-prototypes -Wno-write-strings
-CFLAGS-yp_xdr.c = -Wno-strict-prototypes
-CFLAGS-ypupdate_xdr.c = -Wno-strict-prototypes
-CFLAGS-ypcat.c = -Wno-strict-prototypes
-CFLAGS-ypmatch.c = -Wno-strict-prototypes
-CFLAGS-ypwhich.c = -Wno-strict-prototypes
-CFLAGS-ypset.c = -Wno-strict-prototypes
-CFLAGS-yppoll.c = -Wno-strict-prototypes
-
+CFLAGS-ypclnt.c = -Wno-strict-prototypes -Wno-write-strings -Irpcsvc
+CFLAGS-yp_xdr.c = -Wno-strict-prototypes -Irpcsvc
+CFLAGS-ypupdate_xdr.c = -Wno-strict-prototypes -Irpcsvc
include ../Rules
char *buffer, size_t buflen)
{
char *ypdomain, *host, *user, *domain, *outval, *p, *p2;
- int status, outvallen, p2len;
+ int status, outvallen;
+ size_t p2len;
if (yp_get_default_domain (&ypdomain) != YPERR_SUCCESS)
{
size_t buflen)
{
char *domain, *outkey, *outval, *p, *p2;
- int outkeylen, outvallen, p2len;
+ int outkeylen, outvallen;
+ size_t p2len;
if (yp_get_default_domain (&domain) != YPERR_SUCCESS)
{
while (1)
{
char *p, *p2;
- int p2len;
+ size_t p2len;
do
{
return retval;
}
- if (len + 1 > buflen)
+ if ((size_t) (len + 1) > buflen)
{
free (result);
__set_errno (ERANGE);
return retval;
}
- if (len + 1 > buflen)
+ if ((size_t) (len + 1) > buflen)
{
free (result);
__set_errno (ERANGE);
return retval;
}
- if (len + 1 > buflen)
+ if ((size_t) (len + 1) > buflen)
{
free (result);
__set_errno (ERANGE);
return retval;
}
- if (len + 1 > buflen)
+ if ((size_t) (len + 1) > buflen)
{
free (result);
__set_errno (ERANGE);
return retval;
}
- if (len + 1 > buflen)
+ if ((size_t) (len + 1) > buflen)
{
free (result);
__set_errno (ERANGE);
return retval;
}
- if (len + 1 > buflen)
+ if ((size_t) (len + 1) > buflen)
{
free (result);
__set_errno (ERANGE);
return retval;
}
- if (len + 1 > buflen)
+ if ((size_t) (len + 1) > buflen)
{
free (result);
__set_errno (ERANGE);
return retval;
}
- if (len + 1 > buflen)
+ if ((size_t) (len + 1) > buflen)
{
free (result);
__set_errno (ERANGE);
return retval;
}
- if (len + 1 > linebuflen)
+ if ((size_t) (len + 1) > linebuflen)
{
free (result);
*h_errnop = NETDB_INTERNAL;
return retval;
}
- if (len + 1 > linebuflen)
+ if ((size_t) (len + 1) > linebuflen)
{
free (result);
*h_errnop = NETDB_INTERNAL;
return retval;
}
- if (len + 1 > linebuflen)
+ if ((size_t) (len + 1) > linebuflen)
{
free (result);
__set_errno (ERANGE);
return retval;
}
- if (len + 1 > buflen)
+ if ((size_t) (len + 1) > buflen)
{
free (result);
__set_errno (ERANGE);
return retval;
}
- if (len + 1 > buflen)
+ if ((size_t) (len + 1) > buflen)
{
free (result);
__set_errno (ERANGE);
}
}
- if (len + 1 > buflen)
+ if ((size_t) (len + 1) > buflen)
{
free (result);
__set_errno (ERANGE);
return retval;
}
- if (len + 1 > buflen)
+ if ((size_t) (len + 1) > buflen)
{
free (result);
__set_errno (ERANGE);
return retval;
}
- if (len + 1 > buflen)
+ if ((size_t) (len + 1) > buflen)
{
free (result);
__set_errno (ERANGE);
return retval;
}
- if (len + 1 > buflen)
+ if ((size_t) (len + 1) > buflen)
{
free (result);
__set_errno (ERANGE);
return retval;
}
- if (len + 1 > buflen)
+ if ((size_t) (len + 1) > buflen)
{
free (result);
__set_errno (ERANGE);
return retval;
}
- if (len + 1 > buflen)
+ if ((size_t) (len + 1) > buflen)
{
free (result);
__set_errno (ERANGE);
return retval;
}
- if (len + 1 > buflen)
+ if ((size_t) (len + 1) > buflen)
{
free (result);
__set_errno (ERANGE);
return retval;
}
- if (len + 1 > buflen)
+ if ((size_t) (len + 1) > buflen)
{
free (result);
__set_errno (ERANGE);
return retval;
}
- if (len + 1 > buflen)
+ if ((size_t) (len + 1) > buflen)
{
free (result);
__set_errno (ERANGE);
#include "nss-nis.h"
+
+/* The parser is defined in a different module. */
+extern int _nss_files_parse_servent (char *line, struct servent *result,
+ char *data, size_t datalen);
+
+
+
__libc_lock_define_initialized (static, lock)
struct intern_t
return retval;
}
- if (len + 1 > buflen)
+ if ((size_t) (len + 1) > buflen)
{
free (result);
__set_errno (ERANGE);
return retval;
}
- if (len + 1 > buflen)
+ if ((size_t) (len + 1) > buflen)
{
free (result);
__set_errno (ERANGE);
return retval;
}
- if (len + 1 > buflen)
+ if ((size_t) (len + 1) > buflen)
{
free (result);
__set_errno (ERANGE);
/*
* This file contains symbols and structures defining the rpc protocol
* between the NIS clients and the NIS servers. The servers
- * are the NIS database servers, and the NIS binders.
+ * are the NIS database servers, and the NIS binders.
*/
#ifndef _RPCSVC_YP_PROT_H
/*
* The following procedures are supported by the protocol:
- *
+ *
* YPPROC_NULL() returns () takes nothing, returns nothing. This indicates
* that the NIS server is alive.
- *
+ *
* YPPROC_DOMAIN (char *) returns (bool_t) TRUE. Indicates that the
* responding NIS server does serve the named domain; FALSE indicates no
* support.
- *
+ *
* YPPROC_DOMAIN_NONACK (char *) returns (TRUE) if the NIS server does serve
* the named domain, otherwise does not return. Used in the broadcast case.
- *
+ *
* YPPROC_MATCH (struct ypreq_key) returns (struct ypresp_val). Returns the
* right-hand value for a passed left-hand key, within a named map and
* domain.
- *
+ *
* YPPROC_FIRST (struct ypreq_nokey) returns (struct ypresp_key_val).
* Returns the first key-value pair from a named domain and map.
- *
+ *
* YPPROC_NEXT (struct ypreq_key) returns (struct ypresp_key_val). Returns
* the key-value pair following a passed key-value pair within a named
* domain and map.
* YPPROC_CLEAR takes nothing, returns nothing. Instructs a NIS server to
* close the current map, so that old versions of the disk file don't get
* held open.
- *
+ *
* YPPROC_ALL (struct ypreq_nokey), returns
* union switch (bool_t more) {
* TRUE: (struct ypresp_key_val);
*/
struct ypreq_key {
- char *domain;
- char *map;
+ const char *domain;
+ const char *map;
datum keydat;
};
};
struct ypmaplist {
- char ypml_name[YPMAXMAP + 1];
- struct ypmaplist *ypml_next;
+ char map[YPMAXMAP + 1];
+#define ypml_name map
+ struct ypmaplist *next;
+#define ypml_next next
};
struct ypresp_maplist {
*
* YPBINDPROC_SETDOM takes (struct ypbind_setdom) returns nothing
*/
-
+
/* Program and version symbols, magic numbers */
#define YPBINDPROG ((u_long)100007)
__libc_lock_define_initialized (static, ypbindlist_lock)
static dom_binding *__ypbindlist = NULL;
+extern void xdr_free (xdrproc_t proc, char *objp);
+
static int
-__yp_bind (char *domain, dom_binding ** ypdb)
+__yp_bind (const char *domain, dom_binding ** ypdb)
{
struct sockaddr_in clnt_saddr;
struct ypbind_resp ypbr;
/* The parser is defined in a different module. */
extern int parse_line (char *line, struct STRUCTURE *result,
- struct parser_data *data, int datalen);
+ struct parser_data *data, size_t datalen);
# define LINE_PARSER(EOLSET, BODY) /* Do nothing */
# define LINE_PARSER(EOLSET, BODY) \
parser_stclass int \
parse_line (char *line, struct STRUCTURE *result, \
- struct parser_data *data, int datalen) \
+ struct parser_data *data, size_t datalen) \
{ \
ENTDATA_DECL (data) \
char *p = strpbrk (line, EOLSET "\n"); \
}
static inline char **
-parse_list (char *line, struct parser_data *data, int datalen)
+parse_list (char *line, struct parser_data *data, size_t datalen)
{
char *eol, **list, **p;
{
char *elt;
- if ((char *) &p[1] - (char *) data > datalen)
+ if ((size_t) ((char *) &p[1] - (char *) data) > datalen)
{
/* We cannot fit another pointer in the buffer. */
__set_errno (ERANGE);
struct sigaction saved_act; /* Saved signal action. */
sigset_t new_set; /* New set of caught signals. */
struct sigaction new_act; /* New signal action. */
+ struct flock fl; /* Information struct for locking. */
int result;
if (lock_fd != -1)
alarm (TIMEOUT);
/* Try to get the lock. */
- result = flock (lock_fd, LOCK_EX);
+ memset (&fl, '\0', sizeof (struct flock));
+ fl.l_type = F_WRLCK;
+ fl.l_whence = SEEK_SET;
+ result = fcntl (lock_fd, F_SETLKW, &fl);
RETURN_CLEAR_ALARM (result);
}
noop_handler (sig)
int sig;
{
- /* We simply return which makes the `flock' call return with an error. */
+ /* We simply return which makes the `fcntl' call return with an error. */
}
-/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1991, 1995, 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 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 <stdarg.h>
#include <stdio.h>
/* Write formatted output to stdout from the format string FORMAT. */
/* VARARGS1 */
int
-printf (format)
- const char *format;
+printf (const char *format, ...)
{
va_list arg;
int done;
return done;
}
+
+#ifdef USE_IN_LIBIO
+# undef _IO_printf
+/* This is for libg++. */
+strong_alias (printf, _IO_printf);
+#endif
-/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1991, 1995, 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 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 <stdarg.h>
#include <stdio.h>
return done;
}
+
+#ifdef USE_IN_LIBIO
+# undef _IO_sscanf
+/* This is for libg++. */
+strong_alias (sscanf, _IO_sscanf)
+#endif
/* Copyright (C) 1991, 1993, 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., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+ 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 <stdio.h>
{ \
/* Check file argument for consistence. */ \
CHECK_FILE (s, EOF); \
- if (s->_flags & _IO_NO_READS || format == NULL) \
- { \
- MAYBE_SET_EINVAL; \
- return EOF; \
- } \
+ if (s->_flags & _IO_NO_READS) \
+ { \
+ __set_errno (EBADF); \
+ return EOF; \
+ } \
+ else if (format == NULL) \
+ { \
+ MAYBE_SET_EINVAL; \
+ return EOF; \
+ } \
} while (0)
# define LOCK_STREAM(S) \
__libc_cleanup_region_start ((void (*) (void *)) &_IO_funlockfile, (S)); \
do \
{ \
/* Check file argument for consistence. */ \
- if (!__validfp (s) || !s->__mode.__read || format == NULL) \
+ if (!__validfp (s) || !s->__mode.__read) \
+ { \
+ __set_errno (EBADF); \
+ return EOF; \
+ } \
+ else if (format == NULL) \
{ \
__set_errno (EINVAL); \
return EOF; \
register unsigned char fc; /* Current character of the format. */
register size_t done = 0; /* Assignments done. */
register size_t read_in = 0; /* Chars read in. */
- register int c; /* Last char read. */
+ register int c = 0; /* Last char read. */
register int width; /* Maximum field width. */
register int flags; /* Modifiers for current format element. */
if (skip_space)
{
while (isspace (c))
- (void) inchar ();
+ if (inchar () == EOF && errno == EINTR)
+ conv_error ();
skip_space = 0;
}
if (*f == '\0')
conv_error ();
+ /* We must take care for EINTR errors. */
+ if (c == EOF && errno == EINTR)
+ input_error ();
+
/* Find the conversion specifier. */
fc = *f++;
- if (skip_space || (fc != '[' && fc != 'c' && fc != 'n'))
+ if (skip_space || (fc != '[' && fc != 'c' && fc != 'C' && fc != 'n'))
{
/* Eat whitespace. */
do
- (void) inchar ();
+ if (inchar () == EOF && errno == EINTR)
+ input_error ();
while (isspace (c));
ungetc (c, s);
skip_space = 0;
{ "0xffffffffg", 0xffffffff, 0, 'g', 0 },
{ "0xffffffffffffffffg", 0xffffffffffffffff, 0, 'g', 0 },
{ "0xf1f2f3f4f5f6f7f8f9", 0xffffffffffffffff, 0, 0, ERANGE },
- { "-0x123456789abcdef01", 0, 0, 0, EINVA{ },
+ { "-0x123456789abcdef01", 0, 0, 0, EINVAL },
{ "-0xfedcba987654321", 0, 0, 0, EINVAL },
{ NULL, 0, 0, 0, 0 },
#endif
-/* Copyright (C) 1991, 1993, 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1991, 1993, 1995, 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 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 <ansidecl.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
/* Cause an abnormal program termination with core-dump. */
void
-DEFUN_VOID(abort)
+abort (void)
{
sigset_t sigs;
- if (__sigemptyset(&sigs) == 0 &&
- __sigaddset(&sigs, SIGABRT) == 0)
- (void) __sigprocmask(SIG_UNBLOCK, &sigs, (sigset_t *) NULL);
+ if (__sigemptyset (&sigs) == 0 &&
+ __sigaddset (&sigs, SIGABRT) == 0)
+ __sigprocmask (SIG_UNBLOCK, &sigs, (sigset_t *) NULL);
while (1)
if (raise (SIGABRT))
+++ /dev/null
-/* Copyright (C) 1993, 1995 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., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
-
-#include <ansidecl.h>
-#include <stdlib.h>
-
-/* Cause an abnormal program termination with core-dump. */
-void
-DEFUN_VOID(abort)
-{
- while (1)
- asm ("hlt");
-}
/* Inline math functions for i387.
-Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>
+ Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
-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., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, 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. */
#ifndef __MATH_H
-#define __MATH_H
+#define __MATH_H 1
+
+#if defined __GNUG__ && \
+ (__GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ <= 7))
+/* gcc 2.7.2 and 2.7.2.1 have problems with inlining `long double'
+ functions so we disable this now. */
+#undef __NO_MATH_INLINES
+#define __NO_MATH_INLINES
+#endif
#ifdef __GNUC__
#ifndef __NO_MATH_INLINES
(*streamptr)->__mode.__binary = 1;
#endif
}
+#if defined EMFILE || defined ENFILE || defined EINTR
+ else if (0
+# ifdef EMFILE
+ || errno == EMFILE
+# endif
+# ifdef ENFILE
+ || errno == ENFILE
+# endif
+# ifdef EINTR
+ || errno == EINTR
+# endif
+ )
+ /* We cannot open anymore files since all descriptors are
+ used or because we got a signal. */
+ return NULL;
+#endif
else
continue;
}
#include <features.h>
#include <sys/socket.h>
+
+__BEGIN_DECLS
#include <linux/in.h>
+__END_DECLS
/* Standard well-known ports. The use of these constants is
deprecated. Instead use the contents of the file `/etc/services'
# include "../locale/localeinfo.h"
#endif
+#include <ctype.h>
#include <sys/types.h> /* Some systems define `time_t' here. */
#ifdef TIME_WITH_SYS_TIME
#endif /* ! defined (_LIBC) */
-#define add(n, f) \
+static const char spaces[16] = " ";
+#define add(n, f) \
do \
{ \
- i += (n); \
+ int _n = (n); \
+ int _delta = width - _n; \
+ i += _n + (_delta > 0 ? _delta : 0); \
if (i >= maxsize) \
return 0; \
else \
if (p) \
{ \
+ while (_delta > 0) \
+ { \
+ int _this = _delta > 16 ? 16 : _delta; \
+ memcpy (p, spaces, _this); \
+ p += _this; \
+ _delta -= _this; \
+ } \
f; \
- p += (n); \
+ p += _n; \
} \
} while (0)
-#define cpy(n, s) add ((n), memcpy((PTR) p, (PTR) (s), (n)))
+
+#define cpy(n, s) \
+ add ((n), \
+ if (to_lowcase) \
+ memcpy_lowcase (p, (s), _n); \
+ else \
+ memcpy ((PTR) p, (PTR) (s), _n))
+
+
+
+#ifdef _LIBC
+# define TOUPPER(Ch) toupper (Ch)
+# define TOLOWER(Ch) tolower (Ch)
+#else
+# define TOUPPER(Ch) (islower (Ch) ? toupper (Ch) : (Ch))
+# define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
+#endif
+
+static char *memcpy_lowcase __P ((char *dest, const char *src, size_t len));
+
+static char *
+memcpy_lowcase (dest, src, len)
+ char *dest;
+ const char *src;
+ size_t len;
+{
+ while (len-- > 0)
+ dest[len] = TOLOWER (src[len]);
+ return dest;
+}
#if ! HAVE_TM_GMTOFF
/* Yield the difference between *A and *B,
char *s;
size_t maxsize;
const char *format;
- register const struct tm *tp;
+ const struct tm *tp;
{
int hour12 = tp->tm_hour;
#ifdef _NL_CURRENT
size_t month_len = strlen (f_month);
const char *zone;
size_t zonelen;
- register size_t i = 0;
- register char *p = s;
- register const char *f;
+ size_t i = 0;
+ char *p = s;
+ const char *f;
zone = 0;
#if HAVE_TM_ZONE
char buf[1 + (sizeof (int) < sizeof (time_t)
? INT_STRLEN_BOUND (time_t)
: INT_STRLEN_BOUND (int))];
+ int width = -1;
+ int to_lowcase = 0;
#if DO_MULTIBYTE
/* Check for flags that can modify a number format. */
++f;
- switch (*f)
+ while (1)
{
- case '_':
- case '-':
- pad = *f++;
- break;
+ switch (*f)
+ {
+ case '_':
+ case '-':
+ case '0':
+ pad = *f++;
+ break;
- default:
- pad = 0;
+ default:
+ pad = 0;
+ break;
+ }
break;
}
+ /* As a GNU extension we allow to specify the field width. */
+ if (isdigit (*f))
+ {
+ width = 0;
+ do
+ {
+ width *= 10;
+ width += *f - '0';
+ }
+ while (isdigit (*++f));
+ }
+
/* Check for modifiers. */
switch (*f)
{
subformat:
{
- size_t len = strftime (p, maxsize - i, subfmt, tp);
+ size_t len = strftime (NULL, maxsize - i, subfmt, tp);
if (len == 0 && *subfmt)
return 0;
- add (len, ;);
+ add (len, strftime (p, maxsize - i, subfmt, tp));
}
break;
jump to one of these two labels. */
do_number_spacepad:
- /* Force `_' flag. */
- pad = '_';
+ /* Force `_' flag unless overwritten by `0' flag. */
+ if (pad != '0')
+ pad = '_';
do_number:
/* Format the number according to the MODIFIER flag. */
add (1, *p = '\n');
break;
+ case 'P':
+ to_lowcase = 1;
+ /* FALLTHROUGH */
+
case 'p':
cpy (ap_len, ampm);
break;