diff options
Diffstat (limited to 'lib/posixheaders')
-rw-r--r-- | lib/posixheaders/filecntl.h | 9 | ||||
-rw-r--r-- | lib/posixheaders/memalloc.h | 18 | ||||
-rw-r--r-- | lib/posixheaders/posixdir.h | 49 | ||||
-rw-r--r-- | lib/posixheaders/posixstat.h | 37 | ||||
-rw-r--r-- | lib/posixheaders/stdc.h | 7 |
5 files changed, 87 insertions, 33 deletions
diff --git a/lib/posixheaders/filecntl.h b/lib/posixheaders/filecntl.h index c0b2081..cf5054d 100644 --- a/lib/posixheaders/filecntl.h +++ b/lib/posixheaders/filecntl.h @@ -33,4 +33,13 @@ #define SET_CLOSE_ON_EXEC(fd) (fcntl ((fd), F_SETFD, FD_CLOEXEC)) #define SET_OPEN_ON_EXEC(fd) (fcntl ((fd), F_SETFD, FD_NCLOEXEC)) +/* How to open a file in non-blocking mode, the Posix.1 way. */ +#if !defined (O_NONBLOCK) +# if defined (O_NDELAY) +# define O_NONBLOCK O_NDELAY +# else +# define O_NONBLOCK 0 +# endif +#endif + #endif /* ! _FILECNTL_H_ */ diff --git a/lib/posixheaders/memalloc.h b/lib/posixheaders/memalloc.h index 750d53d..ba210bb 100644 --- a/lib/posixheaders/memalloc.h +++ b/lib/posixheaders/memalloc.h @@ -19,8 +19,8 @@ with Bash; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ -#if !defined (__MEMALLOC_H__) -# define __MEMALLOC_H__ +#if !defined (_MEMALLOC_H_) +# define _MEMALLOC_H_ #if defined (sparc) && defined (sun) && !defined (HAVE_ALLOCA_H) # define HAVE_ALLOCA_H @@ -34,8 +34,6 @@ # define HAVE_ALLOCA #endif /* HAVE_ALLOCA_H && !HAVE_ALLOCA */ -#if !defined (BUILDING_MAKEFILE) - #if defined (__GNUC__) # undef alloca # define alloca __builtin_alloca @@ -46,11 +44,15 @@ # else /* !IBMESA */ # include <alloca.h> # endif /* !IBMESA */ -# else +# else /* !HAVE_ALLOCA_H */ +# if defined (hpux_9) && defined (__STDC__) && !defined (alloca) +extern void *alloca (); +# else +# if !defined (alloca) extern char *alloca (); +# endif /* !alloca */ +# endif /* !hpux_9 || !__STDC__ && !alloca */ # endif /* !HAVE_ALLOCA_H */ #endif /* !__GNUC__ */ -#endif /* !BUILDING_MAKEFILE */ - -#endif /* __MEMALLOC_H__ */ +#endif /* _MEMALLOC_H_ */ diff --git a/lib/posixheaders/posixdir.h b/lib/posixheaders/posixdir.h new file mode 100644 index 0000000..8b0e5bc --- /dev/null +++ b/lib/posixheaders/posixdir.h @@ -0,0 +1,49 @@ +/* posixdir.h -- Posix directory reading includes and defines. */ + +/* Copyright (C) 1987,1991 Free Software Foundation, Inc. + + This file is part of GNU Bash, the Bourne Again SHell. + + Bash is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 1, or (at your option) + any later version. + + Bash 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 General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with Bash; see the file COPYING. If not, write to the Free + Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* This file should be included instead of <dirent.h> or <sys/dir.h>. */ + +#if !defined (_POSIXDIR_H_) +#define _POSIXDIR_H_ + +#if defined (HAVE_DIRENT_H) +# include <dirent.h> +# define D_NAMLEN(d) (strlen ((d)->d_name)) +#else +# if defined (HAVE_SYS_NDIR_H) +# include <sys/ndir.h> +# endif +# if defined (HAVE_SYS_DIR_H) +# include <sys/dir.h> +# endif +# if defined (HAVE_NDIR_H) +# include <ndir.h> +# endif +# if !defined (dirent) +# define dirent direct +# endif /* !dirent */ +# define D_NAMLEN(d) ((d)->d_namlen) +#endif /* !HAVE_DIRENT_H */ + +#if defined (STRUCT_DIRENT_HAS_D_INO) +# define d_fileno d_ino +#endif + +#endif /* !_POSIXDIR_H_ */ diff --git a/lib/posixheaders/posixstat.h b/lib/posixheaders/posixstat.h index 7d1cece..bfce8c0 100644 --- a/lib/posixheaders/posixstat.h +++ b/lib/posixheaders/posixstat.h @@ -21,34 +21,27 @@ /* This file should be included instead of <sys/stat.h>. It relies on the local sys/stat.h to work though. */ -#if !defined (_POSIXSTAT_H) -#define _POSIXSTAT_H +#if !defined (_POSIXSTAT_H_) +#define _POSIXSTAT_H_ #include <sys/stat.h> -#if defined (isc386) -# if !defined (S_IFDIR) -# define S_IFDIR 0040000 -# endif /* !S_IFDIR */ -# if !defined (S_IFMT) -# define S_IFMT 0170000 -# endif /* !S_IFMT */ -#endif /* isc386 */ - -/* This text is taken directly from the Cadmus I was trying to - compile on: - the following MACROs are defined for X/OPEN compatibility - however, is the param correct ?? - #define S_ISBLK(s) ((s.st_mode & S_IFMT) == S_IFBLK) - - Well, the answer is no. Thus... */ -#if defined (BrainDeath) +#if defined (STAT_MACROS_BROKEN) # undef S_ISBLK # undef S_ISCHR # undef S_ISDIR # undef S_ISFIFO # undef S_ISREG -#endif /* BrainDeath */ +# undef S_ISLNK +#endif /* STAT_MACROS_BROKEN */ + +/* These are guaranteed to work only on isc386 */ +#if !defined (S_IFDIR) && !defined (S_ISDIR) +# define S_IFDIR 0040000 +#endif /* !S_IFDIR && !S_ISDIR */ +#if !defined (S_IFMT) +# define S_IFMT 0170000 +#endif /* !S_IFMT */ /* Posix 1003.1 5.6.1.1 <sys/stat.h> file types */ @@ -114,7 +107,7 @@ /* * POSIX 1003.1 5.6.1.2 <sys/stat.h> File Modes */ - + #if !defined (S_IRWXU) # if !defined (S_IREAD) # define S_IREAD 00400 @@ -146,4 +139,4 @@ #define S_IWUGO (S_IWUSR | S_IWGRP | S_IWOTH) #define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) -#endif /* _POSIXSTAT_H */ +#endif /* _POSIXSTAT_H_ */ diff --git a/lib/posixheaders/stdc.h b/lib/posixheaders/stdc.h index 5dcc32b..f1590c6 100644 --- a/lib/posixheaders/stdc.h +++ b/lib/posixheaders/stdc.h @@ -19,14 +19,15 @@ along with Bash; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ -#if !defined (__STDC_H__) -#define __STDC_H__ +#if !defined (_STDC_H_) +#define _STDC_H_ /* Adapted from BSD /usr/include/sys/cdefs.h. */ /* A function can be defined using prototypes and compile on both ANSI C and traditional C compilers with something like this: extern char *func __P((char *, char *, int)); */ + #if defined (__STDC__) # if !defined (__P) @@ -75,4 +76,4 @@ #endif /* !__STDC__ */ -#endif /* !__STDC_H__ */ +#endif /* !_STDC_H_ */ |