diff options
Diffstat (limited to 'sysdeps/generic')
33 files changed, 343 insertions, 217 deletions
diff --git a/sysdeps/generic/bits/byteswap.h b/sysdeps/generic/bits/byteswap.h index 9404cc452e..04a5efe9f0 100644 --- a/sysdeps/generic/bits/byteswap.h +++ b/sysdeps/generic/bits/byteswap.h @@ -17,8 +17,9 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef _BITS_BYTESWAP_H -#define _BITS_BYTESWAP_H 1 +#if !defined _BYTESWAP_H && !defined _NETINET_IN_H +# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead." +#endif /* Swap bytes in 16 bit value. */ #define __bswap_16(x) \ @@ -39,5 +40,3 @@ __r.__l[1] = __bswap_32 (__v.__l[0]); \ __r.__ll; }) #endif - -#endif /* bits/byteswap.h */ diff --git a/sysdeps/generic/bits/confname.h b/sysdeps/generic/bits/confname.h index 40228e11ed..4653887468 100644 --- a/sysdeps/generic/bits/confname.h +++ b/sysdeps/generic/bits/confname.h @@ -17,6 +17,10 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef _UNISTD_H +# error "Never use <bits/confname.h> directly; include <unistd.h> instead." +#endif + /* Values for the NAME argument to `pathconf' and `fpathconf'. */ enum { diff --git a/sysdeps/generic/bits/dirent.h b/sysdeps/generic/bits/dirent.h index 2f7dca78aa..366cdf8ce2 100644 --- a/sysdeps/generic/bits/dirent.h +++ b/sysdeps/generic/bits/dirent.h @@ -1,5 +1,5 @@ /* Directory entry structure `struct dirent'. Stub version. - Copyright (C) 1996 Free Software Foundation, Inc. + Copyright (C) 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 @@ -17,6 +17,10 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef _DIRENT_H +# error "Never use <bits/dirent.h> directly; include <dirent.h> instead." +#endif + struct dirent { char d_name[1]; /* Variable length. */ diff --git a/sysdeps/generic/bits/dlfcn.h b/sysdeps/generic/bits/dlfcn.h index 79604fe8ff..7c33694018 100644 --- a/sysdeps/generic/bits/dlfcn.h +++ b/sysdeps/generic/bits/dlfcn.h @@ -17,8 +17,9 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef _BITS_DLFCN_H -#define _BITS_DLFCN_H 1 +#ifndef _DLFCN_H +# error "Never use <bits/dlfcn.h> directly; include <dlfcn.h> instead." +#endif /* The MODE argument to `dlopen' contains one of the following: */ #define RTLD_LAZY 0x001 /* Lazy function call binding. */ @@ -29,5 +30,3 @@ the symbols of the loaded object and its dependencies are made visible as if the object were linked directly into the program. */ #define RTLD_GLOBAL 0x100 - -#endif /* bits/dlfcn.h */ diff --git a/sysdeps/generic/bits/endian.h b/sysdeps/generic/bits/endian.h index 597f079a0f..45afd4ae47 100644 --- a/sysdeps/generic/bits/endian.h +++ b/sysdeps/generic/bits/endian.h @@ -6,4 +6,8 @@ So if cross-compiling to a machine with a different byte order, the bits/endian.h file for that machine must exist. */ +#ifndef _ENDIAN_H +# error "Never use <bits/endian.h> directly; include <endian.h> instead." +#endif + #error Machine byte order unknown. diff --git a/sysdeps/generic/bits/fenv.h b/sysdeps/generic/bits/fenv.h index f45deb07c1..c42540fa61 100644 --- a/sysdeps/generic/bits/fenv.h +++ b/sysdeps/generic/bits/fenv.h @@ -17,7 +17,7 @@ Boston, MA 02111-1307, USA. */ #ifndef _FENV_H -#error "Never use <bits/fenv.h> directly; include <fenv.h> instead." +# error "Never use <bits/fenv.h> directly; include <fenv.h> instead." #endif diff --git a/sysdeps/generic/bits/huge_val.h b/sysdeps/generic/bits/huge_val.h index 8f137d1734..0c30c86f33 100644 --- a/sysdeps/generic/bits/huge_val.h +++ b/sysdeps/generic/bits/huge_val.h @@ -1,6 +1,6 @@ /* Stub `HUGE_VAL' constant. Used by <stdlib.h> and <math.h> functions for overflow. - Copyright (C) 1992, 1996 Free Software Foundation, Inc. + Copyright (C) 1992, 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 @@ -19,7 +19,7 @@ Boston, MA 02111-1307, USA. */ #ifndef _MATH_H -#error "Never use <bits/huge_val.h> directly; include <math.h> instead." +# error "Never use <bits/huge_val.h> directly; include <math.h> instead." #endif diff --git a/sysdeps/generic/bits/in.h b/sysdeps/generic/bits/in.h index 7241bd24c3..83d7ae6b10 100644 --- a/sysdeps/generic/bits/in.h +++ b/sysdeps/generic/bits/in.h @@ -18,8 +18,9 @@ /* Generic version. */ -#ifndef _NETINET_INBITS_H -#define _NETINET_INBITS_H 1 +#ifndef _NETINET_IN_H +# error "Never use <bits/in.h> directly; include <netinet/in.h> instead." +#endif /* Link numbers. */ #define IMPLINK_IP 155 @@ -55,10 +56,10 @@ struct ip_opts /* Structure used for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. */ struct ip_mreq -{ - struct in_addr imr_multiaddr; /* IP multicast address of group */ - struct in_addr imr_interface; /* local IP address of interface */ -}; + { + struct in_addr imr_multiaddr; /* IP multicast address of group */ + struct in_addr imr_interface; /* local IP address of interface */ + }; /* IPV6 socket options. */ #define IPV6_ADDRFORM 1 @@ -80,5 +81,3 @@ struct ip_mreq #define IPV6_MULTICAST_LOOP 19 #define IPV6_ADD_MEMBERSHIP 20 #define IPV6_DROP_MEMBERSHIP 21 - -#endif /* netinet/inbits.h */ diff --git a/sysdeps/generic/bits/ioctl-types.h b/sysdeps/generic/bits/ioctl-types.h index 1d5c8a002f..26283a0f10 100644 --- a/sysdeps/generic/bits/ioctl-types.h +++ b/sysdeps/generic/bits/ioctl-types.h @@ -1,5 +1,5 @@ /* Structure types for pre-termios terminal ioctls. Generic Unix version. - Copyright (C) 1996 Free Software Foundation, Inc. + Copyright (C) 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 @@ -17,15 +17,11 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* - * Never include this file directly; use <sys/ioctl.h> instead. - */ - -#ifndef _BITS_IOCTL_TYPES_H -#define _BITS_IOCTL_TYPES_H 1 - +#ifndef _SYS_IOCTL_H +# error "Never use <bits/ioctl-types.h> directly; include <sys/ioctl.h> instead." +#endif -#if defined(TIOCGETC) || defined(TIOCSETC) +#if defined TIOCGETC || defined TIOCSETC /* Type of ARG for TIOCGETC and TIOCSETC requests. */ struct tchars { @@ -41,7 +37,7 @@ struct tchars _IOT (_IOTS (char), 6, 0, 0, 0, 0) #endif -#if defined(TIOCGLTC) || defined(TIOCSLTC) +#if defined TIOCGLTC || defined TIOCSLTC /* Type of ARG for TIOCGLTC and TIOCSLTC requests. */ struct ltchars { @@ -70,7 +66,7 @@ struct sgttyb #define _IOT_sgttyb /* Hurd ioctl type field. */ \ _IOT (_IOTS (char), 6, _IOTS (short int), 1, 0, 0) -#if defined(TIOCGWINSZ) || defined(TIOCSWINSZ) +#if defined TIOCGWINSZ || defined TIOCSWINSZ /* Type of ARG for TIOCGWINSZ and TIOCSWINSZ requests. */ struct winsize { @@ -86,13 +82,13 @@ struct winsize _IOT (_IOTS (unsigned short int), 4, 0, 0, 0, 0) #endif -#if defined (TIOCGSIZE) || defined (TIOCSSIZE) +#if defined TIOCGSIZE || defined TIOCSSIZE /* The BSD-style ioctl constructor macros use `sizeof', which can't be used in a preprocessor conditional. Since the commands are always unique regardless of the size bits, we can safely define away `sizeof' for the purpose of the conditional. */ # define sizeof(type) 0 -# if defined (TIOCGWINSZ) && TIOCGSIZE == TIOCGWINSZ +# if defined TIOCGWINSZ && TIOCGSIZE == TIOCGWINSZ /* Many systems that have TIOCGWINSZ define TIOCGSIZE for source compatibility with Sun; they define `struct ttysize' to have identical layout as `struct winsize' and #define TIOCGSIZE to be TIOCGWINSZ @@ -116,6 +112,3 @@ struct ttysize # endif # undef sizeof /* See above. */ #endif - - -#endif /* bits/ioctl-types.h */ diff --git a/sysdeps/generic/bits/ioctls.h b/sysdeps/generic/bits/ioctls.h index 3b6178bfae..d3ecad9515 100644 --- a/sysdeps/generic/bits/ioctls.h +++ b/sysdeps/generic/bits/ioctls.h @@ -1 +1,5 @@ +#ifndef _SYS_IOCTL_H +# error "Never use <bits/ioctls.h> directly; include <sys/ioctl.h> instead." +#endif + /* This space intentionally left blank. */ diff --git a/sysdeps/generic/bits/ipc.h b/sysdeps/generic/bits/ipc.h index a5ecbd90b7..58f419be1d 100644 --- a/sysdeps/generic/bits/ipc.h +++ b/sysdeps/generic/bits/ipc.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. @@ -17,10 +17,9 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef _SYS_IPC_BUF_H - -#define _SYS_IPC_BUF_H 1 -#include <features.h> +#ifndef _SYS_IPC_H +# error "Never use <bits/ipc.h> directly; include <sys/ipc.h> instead." +#endif #include <sys/types.h> @@ -34,23 +33,16 @@ #define IPC_SET 1 /* set `ipc_perm' options */ #define IPC_STAT 2 /* get `ipc_perm' options */ - -__BEGIN_DECLS - /* Special key values. */ #define IPC_PRIVATE ((key_t) 0) /* private key */ /* Data structure used to pass permission information to IPC operations. */ struct ipc_perm -{ - __uid_t uid; /* owner's user ID */ - __gid_t gid; /* owner's group ID */ - __uid_t cuid; /* creator's user ID */ - __gid_t cgid; /* creator's group ID */ - __mode_t mode; /* read/write permission */ -}; - -__END_DECLS - -#endif /* _SYS_IPC_BUF_H */ + { + __uid_t uid; /* owner's user ID */ + __gid_t gid; /* owner's group ID */ + __uid_t cuid; /* creator's user ID */ + __gid_t cgid; /* creator's group ID */ + __mode_t mode; /* read/write permission */ + }; diff --git a/sysdeps/generic/bits/msq.h b/sysdeps/generic/bits/msq.h index 37daa9bf8c..a263869a0e 100644 --- a/sysdeps/generic/bits/msq.h +++ b/sysdeps/generic/bits/msq.h @@ -1,6 +1,5 @@ /* Copyright (C) 1995, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. 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 @@ -21,14 +20,11 @@ #error "Never use <bits/msq.h> directly; include <sys/msg.h> instead." #endif - -#include <features.h> #include <sys/types.h> /* Define options for message queue functions. */ #define MSG_NOERROR 010000 /* no error if message is too big */ -__BEGIN_DECLS /* Structure of record for one message inside the kernel. The type `struct __msg' is opaque. */ @@ -43,5 +39,3 @@ struct msqid_ds __pid_t msg_lspid; /* pid of last msgsnd() */ __pid_t msg_lrpid; /* pid of last msgrcv() */ }; - -__END_DECLS diff --git a/sysdeps/generic/bits/poll.h b/sysdeps/generic/bits/poll.h index 55ec70e363..68f611a428 100644 --- a/sysdeps/generic/bits/poll.h +++ b/sysdeps/generic/bits/poll.h @@ -16,6 +16,9 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef _SYS_POLL_H +# error "Never use <bits/poll.h> directly; include <sys/poll.h> instead." +#endif /* Event types that can be polled for. These bits may be set in `events' to indicate the interesting event types; they will appear in `revents' diff --git a/sysdeps/generic/bits/resource.h b/sysdeps/generic/bits/resource.h index 46cf9a7af5..d0ebeb56c8 100644 --- a/sysdeps/generic/bits/resource.h +++ b/sysdeps/generic/bits/resource.h @@ -17,6 +17,10 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef _SYS_RESOURCE_H +# error "Never use <bits/resource.h> directly; include <sys/resource.h> instead." +#endif + /* These are the values for 4.4 BSD and GNU. Earlier BSD systems have a subset of these kinds of resource limit. In systems where `getrlimit' and `setrlimit' are not system calls, these are the values used by the C @@ -107,7 +111,8 @@ enum __rusage_who #define RUSAGE_CHILDREN RUSAGE_CHILDREN }; -#include <sys/time.h> /* For `struct timeval'. */ +#define __need_timeval +#include <bits/time.h> /* For `struct timeval'. */ /* Structure which says how much of each resource has been used. */ struct rusage diff --git a/sysdeps/generic/bits/sched.h b/sysdeps/generic/bits/sched.h index bb5da5676f..0c246c8f9a 100644 --- a/sysdeps/generic/bits/sched.h +++ b/sysdeps/generic/bits/sched.h @@ -1,6 +1,6 @@ /* Definitions of constants and data structure for POSIX 1003.1b-1993 scheduling interface. - Copyright (C) 1996 Free Software Foundation, Inc. + Copyright (C) 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 @@ -19,7 +19,7 @@ Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _SCHED_H -#error "Never use <bits/sched.h> directly; include <sched.h> instead." +# error "Never include <bits/sched.h> directly; use <sched.h> instead." #endif diff --git a/sysdeps/generic/bits/sem.h b/sysdeps/generic/bits/sem.h index 1d3e41bd56..8b9f97c62a 100644 --- a/sysdeps/generic/bits/sem.h +++ b/sysdeps/generic/bits/sem.h @@ -1,6 +1,5 @@ /* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. 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 @@ -18,11 +17,9 @@ Boston, MA 02111-1307, USA. */ #ifndef _SYS_SEM_H -#error "Never use <bits/sem.h> directly; include <sys/sem.h> instead." +# error "Never include <bits/sem.h> directly; use <sys/sem.h> instead." #endif - -#include <features.h> #include <sys/types.h> /* Flags for `semop'. */ @@ -38,8 +35,6 @@ #define SETALL 17 /* set all semval's */ -__BEGIN_DECLS - /* Data structure describing a set of semaphores. */ struct semid_ds { @@ -57,5 +52,3 @@ union semun unsigned short int *array; /* array for GETALL & SETALL */ struct seminfo *__buf; /* buffer for IPC_INFO */ }; - -__END_DECLS diff --git a/sysdeps/generic/bits/setjmp.h b/sysdeps/generic/bits/setjmp.h index 6620e5ab15..9150d8d764 100644 --- a/sysdeps/generic/bits/setjmp.h +++ b/sysdeps/generic/bits/setjmp.h @@ -1,3 +1,7 @@ /* Define the machine-dependent type `jmp_buf'. Stub version. */ +#ifndef _SETJMP_H +# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." +#endif + typedef int __jmp_buf[1]; diff --git a/sysdeps/generic/bits/shm.h b/sysdeps/generic/bits/shm.h index b41d0c1e86..8c97999626 100644 --- a/sysdeps/generic/bits/shm.h +++ b/sysdeps/generic/bits/shm.h @@ -1,6 +1,5 @@ /* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. 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 @@ -18,11 +17,9 @@ Boston, MA 02111-1307, USA. */ #ifndef _SYS_SHM_H -#error "Never use <bits/shm.h> directly; include <sys/shm.h> instead." +# error "Never include <bits/shm.h> directly; use <sys/shm.h> instead." #endif - -#include <features.h> #include <sys/types.h> /* Flags for `shmat'. */ @@ -35,19 +32,15 @@ #define SHM_UNLOCK 12 /* unlock segment (root only) */ -__BEGIN_DECLS - /* Data structure describing a set of semaphores. */ struct shmid_ds -{ - struct ipc_perm sem_perm; /* operation permission struct */ - int shm_segsz; /* size of segment in bytes */ - __time_t sem_atime; /* time of last shmat() */ - __time_t sem_dtime; /* time of last shmdt() */ - __time_t sem_ctime; /* time of last change by shmctl() */ - __pid_t shm_cpid; /* pid of creator */ - __pid_t shm_lpid; /* pid of last shmop */ - unsigned short int shm_nattch; /* number of current attaches */ -}; - -__END_DECLS + { + struct ipc_perm sem_perm; /* operation permission struct */ + int shm_segsz; /* size of segment in bytes */ + __time_t sem_atime; /* time of last shmat() */ + __time_t sem_dtime; /* time of last shmdt() */ + __time_t sem_ctime; /* time of last change by shmctl() */ + __pid_t shm_cpid; /* pid of creator */ + __pid_t shm_lpid; /* pid of last shmop */ + unsigned short int shm_nattch; /* number of current attaches */ + }; diff --git a/sysdeps/generic/bits/sigaction.h b/sysdeps/generic/bits/sigaction.h index e89479bd1c..4499517b1a 100644 --- a/sysdeps/generic/bits/sigaction.h +++ b/sysdeps/generic/bits/sigaction.h @@ -16,6 +16,10 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef _SIGNAL_H +# error "Never include <bits/sigaction.h> directly; use <signal.h> instead." +#endif + /* These definitions match those used by the 4.4 BSD kernel. If the operating system has a `sigaction' system call that correctly implements the POSIX.1 behavior, there should be a system-dependent diff --git a/sysdeps/generic/bits/sigcontext.h b/sysdeps/generic/bits/sigcontext.h index 46e4df8c64..576fd30c37 100644 --- a/sysdeps/generic/bits/sigcontext.h +++ b/sysdeps/generic/bits/sigcontext.h @@ -17,6 +17,10 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef _SIGNAL_H +# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead." +#endif + /* State of this thread when the signal was taken. */ struct sigcontext { diff --git a/sysdeps/generic/bits/socket.h b/sysdeps/generic/bits/socket.h index af42dfac78..a2858b8de8 100644 --- a/sysdeps/generic/bits/socket.h +++ b/sysdeps/generic/bits/socket.h @@ -18,17 +18,12 @@ Boston, MA 02111-1307, USA. */ #ifndef _SYS_SOCKET_H -#error "Never include <bits/socket.h> directly; use <sys/socket.h> instead." +# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead." #endif - -#include <features.h> - #define __need_size_t #include <stddef.h> -__BEGIN_DECLS - /* Type for length arguments in socket calls. */ typedef unsigned int socklen_t; @@ -201,5 +196,3 @@ struct linger int l_onoff; /* Nonzero to linger on close. */ int l_linger; /* Time to linger. */ }; - -__END_DECLS diff --git a/sysdeps/generic/bits/stat.h b/sysdeps/generic/bits/stat.h index 3648fed738..a0edf2be52 100644 --- a/sysdeps/generic/bits/stat.h +++ b/sysdeps/generic/bits/stat.h @@ -16,16 +16,13 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* - * Never include this file directly; use <sys/stat.h> instead. - */ +#ifndef _SYS_STAT_H +# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." +#endif /* This structure needs to be defined in accordance with the implementation of __stat, __fstat, and __lstat. */ -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 - #include <bits/types.h> /* Structure describing file characteristics. */ @@ -73,20 +70,17 @@ struct stat #ifdef __USE_LARGEFILE64 struct stat64 { - __dev_t st_dev; /* Device. */ - - __ino64_t st_ino; /* File serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __off64_t st_size; /* Size of file, in bytes. */ - - __time_t st_atime; /* Time of last access. */ - __time_t st_mtime; /* Time of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - }; -#endif + __dev_t st_dev; /* Device. */ + __ino64_t st_ino; /* File serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __off64_t st_size; /* Size of file, in bytes. */ -#endif /* bits/stat.h */ + __time_t st_atime; /* Time of last access. */ + __time_t st_mtime; /* Time of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + }; +#endif diff --git a/sysdeps/generic/bits/statfs.h b/sysdeps/generic/bits/statfs.h index 9fa3388801..a92cf52315 100644 --- a/sysdeps/generic/bits/statfs.h +++ b/sysdeps/generic/bits/statfs.h @@ -17,12 +17,9 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* - * Never include this file directly; use <sys/statfs.h> instead. - */ - -#ifndef _BITS_STATFS_H -#define _BITS_STATFS_H 1 +#ifndef _SYS_STATFS_H +# error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead." +#endif #include <bits/types.h> @@ -47,6 +44,3 @@ struct statfs unsigned int f_namelen; unsigned int f_spare[6]; }; - - -#endif /* bits/statfs.h */ diff --git a/sysdeps/generic/bits/stdio_lim.h b/sysdeps/generic/bits/stdio_lim.h index ef873777c9..d9b8fbc749 100644 --- a/sysdeps/generic/bits/stdio_lim.h +++ b/sysdeps/generic/bits/stdio_lim.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1994, 1997 Free Software Foundation, Inc. +/* Stdio limits for non-POSIX systems. + Copyright (C) 1994, 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 @@ -16,22 +17,17 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* <bits/stdio_lim.h>: stdio limits for non-POSIX systems. - * Never include this file directly; use <stdio.h> instead. - */ - -#ifndef _BITS_STDIO_LIM_H -#define _BITS_STDIO_LIM_H +#ifndef _STDIO_H +# error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead." +#endif #define L_tmpnam 1 #define TMP_MAX 0 #ifdef __USE_POSIX -#define L_ctermid 1 -#define L_cuserid 1 +# define L_ctermid 1 +# define L_cuserid 1 #endif #define FOPEN_MAX 16 #define FILENAME_MAX 14 - -#endif diff --git a/sysdeps/generic/bits/termios.h b/sysdeps/generic/bits/termios.h index 9a6aed2bba..da059cbf06 100644 --- a/sysdeps/generic/bits/termios.h +++ b/sysdeps/generic/bits/termios.h @@ -1,5 +1,5 @@ /* termios type and macro definitions. 4.4 BSD/generic GNU version. - Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc. + Copyright (C) 1993, 1994, 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 @@ -17,31 +17,35 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef _TERMIOS_H +# error "Never include <bits/termios.h> directly; use <termios.h> instead." +#endif + /* These macros are also defined in some <bits/ioctls.h> files (with numerically identical values), but this serves to shut up cpp's complaining. */ #ifdef __USE_BSD -#ifdef MDMBUF -#undef MDMBUF -#endif -#ifdef FLUSHO -#undef FLUSHO -#endif -#ifdef PENDIN -#undef PENDIN -#endif +# ifdef MDMBUF +# undef MDMBUF +# endif +# ifdef FLUSHO +# undef FLUSHO +# endif +# ifdef PENDIN +# undef PENDIN +# endif #endif /* __USE_BSD */ #ifdef ECHO -#undef ECHO +# undef ECHO #endif #ifdef TOSTOP -#undef TOSTOP +# undef TOSTOP #endif #ifdef NOFLSH -#undef NOFLSH +# undef NOFLSH #endif @@ -85,15 +89,15 @@ struct termios tcflag_t c_oflag; #define OPOST (1 << 0) /* Perform output processing. */ #ifdef __USE_BSD -#define ONLCR (1 << 1) /* Map NL to CR-NL on output. */ -#define OXTABS (1 << 2) /* Expand tabs to spaces. */ -#define ONOEOT (1 << 8) /* Discard EOT (^D) on output. */ +# define ONLCR (1 << 1) /* Map NL to CR-NL on output. */ +# define OXTABS (1 << 2) /* Expand tabs to spaces. */ +# define ONOEOT (1 << 8) /* Discard EOT (^D) on output. */ #endif /* Control modes. */ tcflag_t c_cflag; #ifdef __USE_BSD -#define CIGNORE (1 << 0) /* Ignore these control flags. */ +# define CIGNORE (1 << 0) /* Ignore these control flags. */ #endif #define CSIZE (CS5|CS6|CS7|CS8) /* Number of bits per byte (mask). */ #define CS5 0 /* 5 bits per byte. */ @@ -107,15 +111,15 @@ struct termios #define HUPCL (1 << 14) /* Hang up on last close. */ #define CLOCAL (1 << 15) /* Ignore modem status lines. */ #ifdef __USE_BSD -#define CCTS_OFLOW (1 << 16) /* CTS flow control of output. */ -#define CRTS_IFLOW (1 << 17) /* RTS flow control of input. */ -#define MDMBUF (1 << 20) /* Carrier flow control of output. */ +# define CCTS_OFLOW (1 << 16) /* CTS flow control of output. */ +# define CRTS_IFLOW (1 << 17) /* RTS flow control of input. */ +# define MDMBUF (1 << 20) /* Carrier flow control of output. */ #endif /* Local modes. */ tcflag_t c_lflag; #ifdef __USE_BSD -#define ECHOKE (1 << 0) /* Visual erase for KILL. */ +# define ECHOKE (1 << 0) /* Visual erase for KILL. */ #endif #define _ECHOE (1 << 1) /* Visual erase for ERASE. */ #define ECHOE _ECHOE @@ -126,15 +130,15 @@ struct termios #define _ECHONL (1 << 4) /* Echo NL even if ECHO is off. */ #define ECHONL _ECHONL #ifdef __USE_BSD -#define ECHOPRT (1 << 5) /* Hardcopy visual erase. */ -#define ECHOCTL (1 << 6) /* Echo control characters as ^X. */ +# define ECHOPRT (1 << 5) /* Hardcopy visual erase. */ +# define ECHOCTL (1 << 6) /* Echo control characters as ^X. */ #endif #define _ISIG (1 << 7) /* Enable signals. */ #define ISIG _ISIG #define _ICANON (1 << 8) /* Do erase and kill processing. */ #define ICANON _ICANON #ifdef __USE_BSD -#define ALTWERASE (1 << 9) /* Alternate WERASE algorithm. */ +# define ALTWERASE (1 << 9) /* Alternate WERASE algorithm. */ #endif #define _IEXTEN (1 << 10) /* Enable DISCARD and LNEXT. */ #define IEXTEN _IEXTEN @@ -142,9 +146,9 @@ struct termios #define _TOSTOP (1 << 22) /* Send SIGTTOU for background output. */ #define TOSTOP _TOSTOP #ifdef __USE_BSD -#define FLUSHO (1 << 23) /* Output being flushed (state). */ -#define NOKERNINFO (1 << 25) /* Disable VSTATUS. */ -#define PENDIN (1 << 29) /* Retype pending input (state). */ +# define FLUSHO (1 << 23) /* Output being flushed (state). */ +# define NOKERNINFO (1 << 25) /* Disable VSTATUS. */ +# define PENDIN (1 << 29) /* Retype pending input (state). */ #endif #define _NOFLSH (1 << 31) /* Disable flush after interrupt. */ #define NOFLSH _NOFLSH @@ -153,32 +157,32 @@ struct termios #define VEOF 0 /* End-of-file character [ICANON]. */ #define VEOL 1 /* End-of-line character [ICANON]. */ #ifdef __USE_BSD -#define VEOL2 2 /* Second EOL character [ICANON]. */ +# define VEOL2 2 /* Second EOL character [ICANON]. */ #endif #define VERASE 3 /* Erase character [ICANON]. */ #ifdef __USE_BSD -#define VWERASE 4 /* Word-erase character [ICANON]. */ +# define VWERASE 4 /* Word-erase character [ICANON]. */ #endif #define VKILL 5 /* Kill-line character [ICANON]. */ #ifdef __USE_BSD -#define VREPRINT 6 /* Reprint-line character [ICANON]. */ +# define VREPRINT 6 /* Reprint-line character [ICANON]. */ #endif #define VINTR 8 /* Interrupt character [ISIG]. */ #define VQUIT 9 /* Quit character [ISIG]. */ #define VSUSP 10 /* Suspend character [ISIG]. */ #ifdef __USE_BSD -#define VDSUSP 11 /* Delayed suspend character [ISIG]. */ +# define VDSUSP 11 /* Delayed suspend character [ISIG]. */ #endif #define VSTART 12 /* Start (X-ON) character [IXON, IXOFF]. */ #define VSTOP 13 /* Stop (X-OFF) character [IXON, IXOFF]. */ #ifdef __USE_BSD -#define VLNEXT 14 /* Literal-next character [IEXTEN]. */ -#define VDISCARD 15 /* Discard character [IEXTEN]. */ +# define VLNEXT 14 /* Literal-next character [IEXTEN]. */ +# define VDISCARD 15 /* Discard character [IEXTEN]. */ #endif #define VMIN 16 /* Minimum number of bytes read at once [!ICANON]. */ #define VTIME 17 /* Time-out value (tenths of a second) [!ICANON]. */ #ifdef __USE_BSD -#define VSTATUS 18 /* Status character [ICANON]. */ +# define VSTATUS 18 /* Status character [ICANON]. */ #endif #define NCCS 20 /* Value duplicated in <hurd/tioctl.defs>. */ cc_t c_cc[NCCS]; @@ -202,8 +206,8 @@ struct termios #define B19200 19200 /* 19200 baud. */ #define B38400 38400 /* 38400 baud. */ #ifdef __USE_BSD -#define EXTA 19200 -#define EXTB 38400 +# define EXTA 19200 +# define EXTB 38400 #endif }; @@ -215,7 +219,7 @@ struct termios #define TCSADRAIN 1 /* Change when pending output is written. */ #define TCSAFLUSH 2 /* Flush pending input before changing. */ #ifdef __USE_BSD -#define TCSASOFT 0x10 /* Flag: Don't alter hardware state. */ +# define TCSASOFT 0x10 /* Flag: Don't alter hardware state. */ #endif /* Values for the QUEUE_SELECTOR argument to `tcflush'. */ diff --git a/sysdeps/generic/bits/time.h b/sysdeps/generic/bits/time.h index e41a991b44..cdbd39f91d 100644 --- a/sysdeps/generic/bits/time.h +++ b/sysdeps/generic/bits/time.h @@ -21,6 +21,16 @@ * Never include this file directly; use <time.h> instead. */ +#ifndef __need_timeval +# ifndef _BITS_TIME_H +# define _BITS_TIME_H 1 + +# define CLOCKS_PER_SEC 60 + +# endif /* bits/time.h */ +#endif + + #ifdef __need_timeval # undef __need_timeval # ifndef _STRUCT_TIMEVAL @@ -34,11 +44,3 @@ struct timeval }; # endif /* struct timeval */ #endif /* need timeval */ - - -#ifndef _BITS_TIME_H -#define _BITS_TIME_H 1 - -#define CLOCKS_PER_SEC 60 - -#endif /* bits/time.h */ diff --git a/sysdeps/generic/bits/uio.h b/sysdeps/generic/bits/uio.h index 1a12697008..56533c1c58 100644 --- a/sysdeps/generic/bits/uio.h +++ b/sysdeps/generic/bits/uio.h @@ -17,7 +17,7 @@ Boston, MA 02111-1307, USA. */ #ifndef _SYS_UIO_H -#error "Never use <bits/uio.h> directly; include <sys/uio.h> instead." +# error "Never include <bits/uio.h> directly; use <sys/uio.h> instead." #endif diff --git a/sysdeps/generic/bits/utmp.h b/sysdeps/generic/bits/utmp.h index ccc318bfa1..62817d36d1 100644 --- a/sysdeps/generic/bits/utmp.h +++ b/sysdeps/generic/bits/utmp.h @@ -17,12 +17,9 @@ Boston, MA 02111-1307, USA. */ #ifndef _UTMP_H -# error "Never use <bits/utmp.h> directly; include <utmp.h> instead." +# error "Never include <bits/utmp.h> directly; use <utmp.h> instead." #endif - -#include <features.h> - #include <paths.h> #include <time.h> @@ -31,7 +28,6 @@ #define UT_LINESIZE 8 #define UT_HOSTSIZE 16 -__BEGIN_DECLS struct lastlog { @@ -51,5 +47,3 @@ struct utmp #define _HAVE_UT_HOST 1 /* We have the ut_host field. */ - -__END_DECLS diff --git a/sysdeps/generic/bits/utmpx.h b/sysdeps/generic/bits/utmpx.h index f85fce0052..e22660f6d6 100644 --- a/sysdeps/generic/bits/utmpx.h +++ b/sysdeps/generic/bits/utmpx.h @@ -17,7 +17,7 @@ Boston, MA 02111-1307, USA. */ #ifndef _UTMPX_H -#error "Never use <bits/utmpx.h> directly; include <utmpx.h> instead." +# error "Never include <bits/utmpx.h> directly; use <utmpx.h> instead." #endif @@ -26,9 +26,9 @@ #define __UT_HOSTSIZE 16 struct utmpx -{ - char ut_line[__UT_LINESIZE]; - char ut_name[__UT_NAMESIZE]; - char ut_host[__UT_HOSTSIZE]; - long ut_time; -}; + { + char ut_line[__UT_LINESIZE]; + char ut_name[__UT_NAMESIZE]; + char ut_host[__UT_HOSTSIZE]; + long int ut_time; + }; diff --git a/sysdeps/generic/bits/utsname.h b/sysdeps/generic/bits/utsname.h index 5594bcc4da..ea3f163cef 100644 --- a/sysdeps/generic/bits/utsname.h +++ b/sysdeps/generic/bits/utsname.h @@ -1,3 +1,25 @@ +/* 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. */ + +#ifndef _UTSNAME_H +# error "Never include <bits/utsname.h> directly; use <sys/utsname.h> instead." +#endif + /* The size of the character arrays used to hold the information in a `struct utsname'. Enlarge this as necessary. */ #define _UTSNAME_LENGTH 1024 diff --git a/sysdeps/generic/bits/waitflags.h b/sysdeps/generic/bits/waitflags.h index 127eb6ce4c..596df932b7 100644 --- a/sysdeps/generic/bits/waitflags.h +++ b/sysdeps/generic/bits/waitflags.h @@ -18,7 +18,7 @@ Boston, MA 02111-1307, USA. */ #ifndef _SYS_WAIT_H -#error "Never use <bits/waitflags.h> directly; include <sys/wait.h> instead." +# error "Never include <bits/waitflags.h> directly; use <sys/wait.h> instead." #endif diff --git a/sysdeps/generic/bits/waitstatus.h b/sysdeps/generic/bits/waitstatus.h index 8e97f2702c..1ec55107f9 100644 --- a/sysdeps/generic/bits/waitstatus.h +++ b/sysdeps/generic/bits/waitstatus.h @@ -18,7 +18,7 @@ Boston, MA 02111-1307, USA. */ #ifndef _SYS_WAIT_H -#error "Never use <bits/waitstatus.h> directly; include <sys/wait.h> instead." +# error "Never include <bits/waitstatus.h> directly; use <sys/wait.h> instead." #endif @@ -39,11 +39,11 @@ /* Nonzero if STATUS indicates termination by a signal. */ #ifdef __GNUC__ -#define __WIFSIGNALED(status) \ +# define __WIFSIGNALED(status) \ (__extension__ ({ int __status = (status); \ !__WIFSTOPPED(__status) && !__WIFEXITED(__status); })) #else /* Not GCC. */ -#define __WIFSIGNALED(status) (!__WIFSTOPPED(status) && !__WIFEXITED(status)) +# define __WIFSIGNALED(status) (!__WIFSTOPPED(status) && !__WIFEXITED(status)) #endif /* GCC. */ /* Nonzero if STATUS indicates the child is stopped. */ @@ -60,45 +60,45 @@ #ifdef __USE_BSD -#include <endian.h> +# include <endian.h> union wait { int w_status; struct { -#if __BYTE_ORDER == __LITTLE_ENDIAN +# if __BYTE_ORDER == __LITTLE_ENDIAN unsigned int __w_termsig:7; /* Terminating signal. */ unsigned int __w_coredump:1; /* Set if dumped core. */ unsigned int __w_retcode:8; /* Return code if exited normally. */ unsigned int:16; -#endif /* Little endian. */ -#if __BYTE_ORDER == __BIG_ENDIAN +# endif /* Little endian. */ +# if __BYTE_ORDER == __BIG_ENDIAN unsigned int:16; unsigned int __w_retcode:8; unsigned int __w_coredump:1; unsigned int __w_termsig:7; -#endif /* Big endian. */ +# endif /* Big endian. */ } __wait_terminated; struct { -#if __BYTE_ORDER == __LITTLE_ENDIAN +# if __BYTE_ORDER == __LITTLE_ENDIAN unsigned int __w_stopval:8; /* W_STOPPED if stopped. */ unsigned int __w_stopsig:8; /* Stopping signal. */ unsigned int:16; -#endif /* Little endian. */ -#if __BYTE_ORDER == __BIG_ENDIAN +# endif /* Little endian. */ +# if __BYTE_ORDER == __BIG_ENDIAN unsigned int:16; unsigned int __w_stopsig:8; /* Stopping signal. */ unsigned int __w_stopval:8; /* W_STOPPED if stopped. */ -#endif /* Big endian. */ +# endif /* Big endian. */ } __wait_stopped; }; -#define w_termsig __wait_terminated.__w_termsig -#define w_coredump __wait_terminated.__w_coredump -#define w_retcode __wait_terminated.__w_retcode -#define w_stopsig __wait_stopped.__w_stopsig -#define w_stopval __wait_stopped.__w_stopval +# define w_termsig __wait_terminated.__w_termsig +# define w_coredump __wait_terminated.__w_coredump +# define w_retcode __wait_terminated.__w_retcode +# define w_stopsig __wait_stopped.__w_stopsig +# define w_stopval __wait_stopped.__w_stopval #endif /* Use BSD. */ diff --git a/sysdeps/generic/strcasestr.c b/sysdeps/generic/strcasestr.c new file mode 100644 index 0000000000..ec8727d268 --- /dev/null +++ b/sysdeps/generic/strcasestr.c @@ -0,0 +1,129 @@ +/* Return the offset of one string within another. + Copyright (C) 1994, 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 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. */ + +/* + * My personal strstr() implementation that beats most other algorithms. + * Until someone tells me otherwise, I assume that this is the + * fastest implementation of strstr() in C. + * I deliberately chose not to comment it. You should have at least + * as much fun trying to understand it, as I had to write it :-). + * + * Stephen R. van den Berg, berg@pool.informatik.rwth-aachen.de */ + +#if HAVE_CONFIG_H +# include <config.h> +#endif + +#include <ctype.h> + +#if defined _LIBC || defined HAVE_STRING_H +# include <string.h> +#endif + +typedef unsigned chartype; + +#undef strstr + +char * +__strcasestr (phaystack, pneedle) + const char *phaystack; + const char *pneedle; +{ + register const unsigned char *haystack, *needle; + register chartype b, c; + + haystack = (const unsigned char *) phaystack; + needle = (const unsigned char *) pneedle; + + b = tolower (*needle); + if (b != '\0') + { + haystack--; /* possible ANSI violation */ + do + { + c = *++haystack; + if (c == '\0') + goto ret0; + } + while (tolower (c) != b); + + c = tolower (*++needle); + if (c == '\0') + goto foundneedle; + ++needle; + goto jin; + + for (;;) + { + register chartype a; + register const unsigned char *rhaystack, *rneedle; + + do + { + a = *++haystack; + if (a == '\0') + goto ret0; + if (tolower (a) == b) + break; + a = *++haystack; + if (a == '\0') + goto ret0; +shloop: } + while (tolower (a) != b); + +jin: a = *++haystack; + if (a == '\0') + goto ret0; + + if (tolower (a) != c) + goto shloop; + + rhaystack = haystack-- + 1; + rneedle = needle; + a = tolower (*rneedle); + + if (tolower (*rhaystack) == a) + do + { + if (a == '\0') + goto foundneedle; + ++rhaystack; + a = tolower (*++needle); + if (tolower (*rhaystack) != a) + break; + if (a == '\0') + goto foundneedle; + ++rhaystack; + a = tolower (*++needle); + } + while (tolower (*rhaystack) == a); + + needle = rneedle; /* took the register-poor approach */ + + if (a == '\0') + break; + } + } +foundneedle: + return (char*) haystack; +ret0: + return 0; +} + +weak_alias (__strcasestr, strcasestr) |