summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/ansi_stdlib.h41
-rw-r--r--include/filecntl.h45
-rw-r--r--include/maxpath.h75
-rw-r--r--include/memalloc.h58
-rw-r--r--include/posixdir.h49
-rw-r--r--include/posixjmp.h40
-rw-r--r--include/posixstat.h142
-rw-r--r--include/posixtime.h49
-rw-r--r--include/posixwait.h103
-rw-r--r--include/shtty.h101
-rw-r--r--include/stdc.h81
-rw-r--r--include/systimes.h55
-rw-r--r--include/unionwait.h98
13 files changed, 937 insertions, 0 deletions
diff --git a/include/ansi_stdlib.h b/include/ansi_stdlib.h
new file mode 100644
index 00000000..a720cb9b
--- /dev/null
+++ b/include/ansi_stdlib.h
@@ -0,0 +1,41 @@
+/* ansi_stdlib.h -- An ANSI Standard stdlib.h. */
+/* A minimal stdlib.h containing extern declarations for those functions
+ that bash uses. */
+
+/* Copyright (C) 1993 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 2, 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, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+#if !defined (_STDLIB_H_)
+#define _STDLIB_H_ 1
+
+/* String conversion functions. */
+extern int atoi ();
+extern long int atol ();
+
+/* Memory allocation functions. */
+extern char *malloc ();
+extern char *realloc ();
+extern void free ();
+
+/* Other miscellaneous functions. */
+extern void abort ();
+extern void exit ();
+extern char *getenv ();
+extern void qsort ();
+
+#endif /* _STDLIB_H */
diff --git a/include/filecntl.h b/include/filecntl.h
new file mode 100644
index 00000000..2304d5d0
--- /dev/null
+++ b/include/filecntl.h
@@ -0,0 +1,45 @@
+/* filecntl.h - Definitions to set file descriptors to close-on-exec. */
+
+/* Copyright (C) 1993 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 2, 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, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+#if !defined (_FILECNTL_H_)
+#define _FILECNTL_H_
+
+#include <fcntl.h>
+
+/* Definitions to set file descriptors to close-on-exec, the Posix way. */
+#if !defined (FD_CLOEXEC)
+#define FD_CLOEXEC 1
+#endif
+
+#define FD_NCLOEXEC 0
+
+#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/include/maxpath.h b/include/maxpath.h
new file mode 100644
index 00000000..00e43f84
--- /dev/null
+++ b/include/maxpath.h
@@ -0,0 +1,75 @@
+/* maxpath.h - Find out what this system thinks PATH_MAX and NAME_MAX are. */
+
+/* Copyright (C) 1993 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 2, 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, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+#if !defined (_MAXPATH_H_)
+#define _MAXPATH_H_
+
+/* These values are supposed to be in <limits.h> or one of the files
+ it includes. */
+#if defined (HAVE_LIMITS_H)
+# include <limits.h>
+#endif /* !HAVE_LIMITS_H */
+
+/* If PATH_MAX is not defined, look for MAXPATHLEN */
+#if !defined (PATH_MAX)
+# if defined (HAVE_SYS_PARAM_H)
+# include <sys/param.h>
+# define maxpath_param_h
+# endif
+# if defined (MAXPATHLEN) && !defined (PATH_MAX)
+# define PATH_MAX MAXPATHLEN
+# endif /* MAXPATHLEN && !PATH_MAX */
+#endif /* !PATH_MAX */
+
+/* If NAME_MAX is not defined, look for MAXNAMLEN */
+#if !defined (NAME_MAX)
+# if defined (HAVE_SYS_PARAM_H) && !defined (maxpath_param_h)
+# include <sys/param.h>
+# endif
+# if defined (MAXNAMLEN) && !defined (NAME_MAX)
+# define NAME_MAX MAXNAMLEN
+# endif /* MAXNAMLEN && !NAME_MAX */
+#endif /* !NAME_MAX */
+
+/* Default POSIX values */
+#if !defined (PATH_MAX) && defined (_POSIX_PATH_MAX)
+# define PATH_MAX _POSIX_PATH_MAX
+#endif
+
+#if !defined (NAME_MAX) && defined (_POSIX_NAME_MAX)
+# define NAME_MAX _POSIX_NAME_MAX
+#endif
+
+
+/* Default values */
+#if !defined (PATH_MAX)
+# define PATH_MAX 1024
+#endif
+
+#if !defined (NAME_MAX)
+# define NAME_MAX 14
+#endif
+
+#if PATH_MAX < 1024
+# undef PATH_MAX
+# define PATH_MAX 1024
+#endif
+
+#endif /* _MAXPATH_H_ */
diff --git a/include/memalloc.h b/include/memalloc.h
new file mode 100644
index 00000000..a1a27069
--- /dev/null
+++ b/include/memalloc.h
@@ -0,0 +1,58 @@
+/* memalloc.h -- consolidate code for including alloca.h or malloc.h and
+ defining alloca. */
+
+/* Copyright (C) 1993 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 2, 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, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+#if !defined (_MEMALLOC_H_)
+# define _MEMALLOC_H_
+
+#if defined (sparc) && defined (sun) && !defined (HAVE_ALLOCA_H)
+# define HAVE_ALLOCA_H
+#endif
+
+#if defined (__GNUC__) && !defined (HAVE_ALLOCA)
+# define HAVE_ALLOCA
+#endif
+
+#if defined (HAVE_ALLOCA_H) && !defined (HAVE_ALLOCA)
+# define HAVE_ALLOCA
+#endif /* HAVE_ALLOCA_H && !HAVE_ALLOCA */
+
+#if defined (__GNUC__) && !defined (C_ALLOCA)
+# undef alloca
+# define alloca __builtin_alloca
+#else /* !__GNUC__ || C_ALLOCA */
+# if defined (HAVE_ALLOCA_H) && !defined (C_ALLOCA)
+# if defined (IBMESA)
+# include <malloc.h>
+# else /* !IBMESA */
+# include <alloca.h>
+# endif /* !IBMESA */
+# else /* !HAVE_ALLOCA_H || C_ALLOCA */
+# if defined (__hpux) && defined (__STDC__) && !defined (alloca)
+extern void *alloca ();
+# else
+# if !defined (alloca)
+extern char *alloca ();
+# endif /* !alloca */
+# endif /* !__hpux || !__STDC__ && !alloca */
+# endif /* !HAVE_ALLOCA_H || C_ALLOCA */
+#endif /* !__GNUC__ || C_ALLOCA */
+
+#endif /* _MEMALLOC_H_ */
diff --git a/include/posixdir.h b/include/posixdir.h
new file mode 100644
index 00000000..98ced75b
--- /dev/null
+++ b/include/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 2, 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, 59 Temple Place, Suite 330, Boston, MA 02111 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) && !defined (STRUCT_DIRENT_HAS_D_FILENO)
+# define d_fileno d_ino
+#endif
+
+#endif /* !_POSIXDIR_H_ */
diff --git a/include/posixjmp.h b/include/posixjmp.h
new file mode 100644
index 00000000..b52aa003
--- /dev/null
+++ b/include/posixjmp.h
@@ -0,0 +1,40 @@
+/* posixjmp.h -- wrapper for setjmp.h with changes for POSIX systems. */
+
+/* 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 2, 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, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+#ifndef _POSIXJMP_H_
+#define _POSIXJMP_H_
+
+#include <setjmp.h>
+
+/* This *must* be included *after* config.h */
+
+#if defined (HAVE_POSIX_SIGSETJMP)
+# define procenv_t sigjmp_buf
+# if !defined (__OPENNT)
+# undef setjmp
+# define setjmp(x) sigsetjmp((x), 1)
+# undef longjmp
+# define longjmp(x, n) siglongjmp((x), (n))
+# endif /* !__OPENNT */
+#else
+# define procenv_t jmp_buf
+#endif
+
+#endif /* _POSIXJMP_H_ */
diff --git a/include/posixstat.h b/include/posixstat.h
new file mode 100644
index 00000000..c93b5288
--- /dev/null
+++ b/include/posixstat.h
@@ -0,0 +1,142 @@
+/* posixstat.h -- Posix stat(2) definitions for systems that
+ don't have them. */
+
+/* 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 2, 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, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+/* 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_
+
+#include <sys/stat.h>
+
+#if defined (STAT_MACROS_BROKEN)
+# undef S_ISBLK
+# undef S_ISCHR
+# undef S_ISDIR
+# undef S_ISFIFO
+# undef S_ISREG
+# 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 */
+
+/* Some Posix-wannabe systems define _S_IF* macros instead of S_IF*, but
+ do not provide the S_IS* macros that Posix requires. */
+
+#if defined (_S_IFMT) && !defined (S_IFMT)
+#define S_IFMT _S_IFMT
+#endif
+#if defined (_S_IFIFO) && !defined (S_IFIFO)
+#define S_IFIFO _S_IFIFO
+#endif
+#if defined (_S_IFCHR) && !defined (S_IFCHR)
+#define S_IFCHR _S_IFCHR
+#endif
+#if defined (_S_IFDIR) && !defined (S_IFDIR)
+#define S_IFDIR _S_IFDIR
+#endif
+#if defined (_S_IFBLK) && !defined (S_IFBLK)
+#define S_IFBLK _S_IFBLK
+#endif
+#if defined (_S_IFREG) && !defined (S_IFREG)
+#define S_IFREG _S_IFREG
+#endif
+#if defined (_S_IFLNK) && !defined (S_IFLNK)
+#define S_IFLNK _S_IFLNK
+#endif
+#if defined (_S_IFSOCK) && !defined (S_IFSOCK)
+#define S_IFSOCK _S_IFSOCK
+#endif
+
+/* Test for each symbol individually and define the ones necessary (some
+ systems claiming Posix compatibility define some but not all). */
+
+#if defined (S_IFBLK) && !defined (S_ISBLK)
+#define S_ISBLK(m) (((m)&S_IFMT) == S_IFBLK) /* block device */
+#endif
+
+#if defined (S_IFCHR) && !defined (S_ISCHR)
+#define S_ISCHR(m) (((m)&S_IFMT) == S_IFCHR) /* character device */
+#endif
+
+#if defined (S_IFDIR) && !defined (S_ISDIR)
+#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) /* directory */
+#endif
+
+#if defined (S_IFREG) && !defined (S_ISREG)
+#define S_ISREG(m) (((m)&S_IFMT) == S_IFREG) /* file */
+#endif
+
+#if defined (S_IFIFO) && !defined (S_ISFIFO)
+#define S_ISFIFO(m) (((m)&S_IFMT) == S_IFIFO) /* fifo - named pipe */
+#endif
+
+#if defined (S_IFLNK) && !defined (S_ISLNK)
+#define S_ISLNK(m) (((m)&S_IFMT) == S_IFLNK) /* symbolic link */
+#endif
+
+#if defined (S_IFSOCK) && !defined (S_ISSOCK)
+#define S_ISSOCK(m) (((m)&S_IFMT) == S_IFSOCK) /* socket */
+#endif
+
+/*
+ * POSIX 1003.1 5.6.1.2 <sys/stat.h> File Modes
+ */
+
+#if !defined (S_IRWXU)
+# if !defined (S_IREAD)
+# define S_IREAD 00400
+# define S_IWRITE 00200
+# define S_IEXEC 00100
+# endif /* S_IREAD */
+
+# if !defined (S_IRUSR)
+# define S_IRUSR S_IREAD /* read, owner */
+# define S_IWUSR S_IWRITE /* write, owner */
+# define S_IXUSR S_IEXEC /* execute, owner */
+
+# define S_IRGRP (S_IREAD >> 3) /* read, group */
+# define S_IWGRP (S_IWRITE >> 3) /* write, group */
+# define S_IXGRP (S_IEXEC >> 3) /* execute, group */
+
+# define S_IROTH (S_IREAD >> 6) /* read, other */
+# define S_IWOTH (S_IWRITE >> 6) /* write, other */
+# define S_IXOTH (S_IEXEC >> 6) /* execute, other */
+# endif /* !S_IRUSR */
+
+# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
+# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
+# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
+#endif /* !S_IRWXU */
+
+/* These are non-standard, but are used in builtins.c$symbolic_umask() */
+#define S_IRUGO (S_IRUSR | S_IRGRP | S_IROTH)
+#define S_IWUGO (S_IWUSR | S_IWGRP | S_IWOTH)
+#define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
+
+#endif /* _POSIXSTAT_H_ */
diff --git a/include/posixtime.h b/include/posixtime.h
new file mode 100644
index 00000000..b4c4c68d
--- /dev/null
+++ b/include/posixtime.h
@@ -0,0 +1,49 @@
+/* posixtime.h -- wrapper for time.h, sys/times.h mess. */
+
+/* Copyright (C) 1999 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 2, 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, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+#ifndef _POSIXTIME_H_
+#define _POSIXTIME_H_
+
+/* include this after config.h */
+/* Some systems require this, mostly for the definition of `struct timezone'.
+ For example, Dynix/ptx has that definition in <time.h> rather than
+ sys/time.h */
+#if defined (TIME_WITH_SYS_TIME)
+# include <sys/time.h>
+# include <time.h>
+#else
+# if defined (HAVE_SYS_TIME_H)
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#if !defined (HAVE_SYSCONF) || !defined (_SC_CLK_TCK)
+# if !defined (CLK_TCK)
+# if defined (HZ)
+# define CLK_TCK HZ
+# else
+# define CLK_TCK 60 /* 60HZ */
+# endif
+# endif /* !CLK_TCK */
+#endif /* !HAVE_SYSCONF && !_SC_CLK_TCK */
+
+#endif /* _POSIXTIME_H_ */
diff --git a/include/posixwait.h b/include/posixwait.h
new file mode 100644
index 00000000..a11d156c
--- /dev/null
+++ b/include/posixwait.h
@@ -0,0 +1,103 @@
+/* posixwait.h -- job control definitions from POSIX 1003.1 */
+
+/* Copyright (C) 1997 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 2, 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, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+#if !defined (_POSIXWAIT_H_)
+# define _POSIXWAIT_H_
+
+/* If _POSIX_VERSION is not defined, we assume that <sys/wait.h> defines
+ a `union wait' and various macros used to manipulate it. Look in
+ unionwait.h for the things we expect to find. */
+#if defined (HAVE_SYS_WAIT_H)
+# include <sys/wait.h>
+#else /* !HAVE_SYS_WAIT_H */
+# if !defined (_POSIX_VERSION)
+# include "unionwait.h"
+# endif
+#endif /* !HAVE_SYS_WAIT_H */
+
+/* How to get the status of a job. For Posix, this is just an
+ int, but for other systems we have to crack the union wait. */
+#if !defined (_POSIX_VERSION)
+typedef union wait WAIT;
+# define WSTATUS(t) (t.w_status)
+#else /* _POSIX_VERSION */
+typedef int WAIT;
+# define WSTATUS(t) (t)
+#endif /* _POSIX_VERSION */
+
+/* Make sure that parameters to wait3 are defined. */
+#if !defined (WNOHANG)
+# define WNOHANG 1
+# define WUNTRACED 2
+#endif /* WNOHANG */
+
+/* More Posix P1003.1 definitions. In the POSIX versions, the parameter is
+ passed as an `int', in the non-POSIX version, as `union wait'. */
+#if defined (_POSIX_VERSION)
+
+# if !defined (WSTOPSIG)
+# define WSTOPSIG(s) ((s) >> 8)
+# endif /* !WSTOPSIG */
+
+# if !defined (WTERMSIG)
+# define WTERMSIG(s) ((s) & 0177)
+# endif /* !WTERMSIG */
+
+# if !defined (WEXITSTATUS)
+# define WEXITSTATUS(s) ((s) >> 8)
+# endif /* !WEXITSTATUS */
+
+# if !defined (WIFSTOPPED)
+# define WIFSTOPPED(s) (((s) & 0177) == 0177)
+# endif /* !WIFSTOPPED */
+
+# if !defined (WIFEXITED)
+# define WIFEXITED(s) (((s) & 0377) == 0)
+# endif /* !WIFEXITED */
+
+# if !defined (WIFSIGNALED)
+# define WIFSIGNALED(s) (!WIFSTOPPED(s) && !WIFEXITED(s))
+# endif /* !WIFSIGNALED */
+
+# if !defined (WIFCORED)
+# define WIFCORED(s) ((s) & 0200)
+# endif /* !WIFCORED */
+
+#else /* !_POSIX_VERSION */
+
+# if !defined (WSTOPSIG)
+# define WSTOPSIG(s) ((s).w_stopsig)
+# endif /* !WSTOPSIG */
+
+# if !defined (WTERMSIG)
+# define WTERMSIG(s) ((s).w_termsig)
+# endif /* !WTERMSIG */
+
+# if !defined (WEXITSTATUS)
+# define WEXITSTATUS(s) ((s).w_retcode)
+# endif /* !WEXITSTATUS */
+
+# if !defined (WIFCORED)
+# define WIFCORED(s) ((s).w_coredump)
+# endif /* !WIFCORED */
+
+#endif /* !_POSIX_VERSION */
+
+#endif /* !_POSIXWAIT_H_ */
diff --git a/include/shtty.h b/include/shtty.h
new file mode 100644
index 00000000..9efd3e50
--- /dev/null
+++ b/include/shtty.h
@@ -0,0 +1,101 @@
+/* Copyright (C) 1999 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 2, 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, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+/*
+ * shtty.h -- include the correct system-dependent files to manipulate the
+ * tty
+ */
+
+#ifndef __SH_TTY_H_
+#define __SH_TTY_H_
+
+#include "stdc.h"
+
+#if defined (_POSIX_VERSION) && defined (HAVE_TERMIOS_H) && defined (HAVE_TCGETATTR) && !defined (TERMIOS_MISSING)
+# define TERMIOS_TTY_DRIVER
+#else
+# if defined (HAVE_TERMIO_H)
+# define TERMIO_TTY_DRIVER
+# else
+# define NEW_TTY_DRIVER
+# endif
+#endif
+
+/*
+ * The _POSIX_SOURCE define is to avoid multiple symbol definitions
+ * between sys/ioctl.h and termios.h. Ditto for the test against SunOS4
+ * and the undefining of several symbols.
+ */
+
+#ifdef TERMIOS_TTY_DRIVER
+# if (defined (SunOS4) || defined (SunOS5)) && !defined (_POSIX_SOURCE)
+# define _POSIX_SOURCE
+# endif
+# if defined (SunOS4)
+# undef ECHO
+# undef NOFLSH
+# undef TOSTOP
+# endif /* SunOS4 */
+# include <termios.h>
+# define TTYSTRUCT struct termios
+#else
+# ifdef TERMIO_TTY_DRIVER
+# include <termio.h>
+# define TTYSTRUCT struct termio
+# else /* NEW_TTY_DRIVER */
+# include <sgtty.h>
+# define TTYSTRUCT struct sgttyb
+# endif
+#endif
+
+/* Functions imported from lib/sh/shtty.c */
+
+/* Get and set terminal attributes for the file descriptor passed as
+ an argument. */
+extern int ttgetattr __P((int, TTYSTRUCT *));
+extern int ttsetattr __P((int, TTYSTRUCT *));
+
+/* Save and restore the terminal's attributes from static storage. */
+extern void ttsave __P((void));
+extern void ttrestore __P((void));
+
+/* Return the attributes corresponding to the file descriptor (0 or 1)
+ passed as an argument. */
+extern TTYSTRUCT *ttattr __P((int));
+
+/* These functions only operate on the passed TTYSTRUCT; they don't
+ actually change anything with the kernel's current tty settings. */
+extern int tt_setonechar __P((TTYSTRUCT *));
+extern int tt_setnoecho __P((TTYSTRUCT *));
+extern int tt_seteightbit __P((TTYSTRUCT *));
+extern int tt_setnocanon __P((TTYSTRUCT *));
+extern int tt_setcbreak __P((TTYSTRUCT *));
+
+/* These functions are all generally mutually exclusive. If you call
+ more than one (bracketed with calls to ttsave and ttrestore, of
+ course), the right thing will happen, but more system calls will be
+ executed than absolutely necessary. You can do all of this yourself
+ with the other functions; these are only conveniences. */
+extern int ttonechar __P((void));
+extern int ttnoecho __P((void));
+extern int tteightbit __P((void));
+extern int ttnocanon __P((void));
+
+extern int ttcbreak __P((void));
+
+#endif
diff --git a/include/stdc.h b/include/stdc.h
new file mode 100644
index 00000000..c216a697
--- /dev/null
+++ b/include/stdc.h
@@ -0,0 +1,81 @@
+/* stdc.h -- macros to make source compile on both ANSI C and K&R C
+ compilers. */
+
+/* Copyright (C) 1993 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 2, 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, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+#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 (__P)
+# if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus)
+# define __P(protos) protos
+# else
+# define __P(protos) ()
+# endif
+#endif
+
+#if defined (__STDC__)
+
+# define __STRING(x) #x
+
+# if !defined (__GNUC__)
+# define inline
+# endif
+
+#else /* !__STDC__ */
+
+# define __STRING(x) "x"
+
+#if defined (__GNUC__) /* gcc with -traditional */
+# if !defined (const)
+# define const __const
+# endif
+# if !defined (inline)
+# define inline __inline
+# endif
+# if !defined (signed)
+# define signed __signed
+# endif
+# if !defined (volatile)
+# define volatile __volatile
+# endif
+#else /* !__GNUC__ */
+# if !defined (const)
+# define const
+# endif
+# if !defined (inline)
+# define inline
+# endif
+# if !defined (signed)
+# define signed
+# endif
+# if !defined (volatile)
+# define volatile
+# endif
+#endif /* !__GNUC__ */
+
+#endif /* !__STDC__ */
+
+#endif /* !_STDC_H_ */
diff --git a/include/systimes.h b/include/systimes.h
new file mode 100644
index 00000000..fe969f94
--- /dev/null
+++ b/include/systimes.h
@@ -0,0 +1,55 @@
+/* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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. */
+
+/*
+ * POSIX Standard: 4.5.2 Process Times <sys/times.h>
+ */
+
+/*
+ * If we don't have a standard system clock_t type, this must be included
+ * after config.h
+ */
+
+#ifndef _BASH_SYSTIMES_H
+#define _BASH_SYSTIMES_H 1
+
+#if defined (HAVE_SYS_TIMES_H)
+# include <sys/times.h>
+#else /* !HAVE_SYS_TIMES_H */
+
+#include <stdc.h>
+
+/* Structure describing CPU time used by a process and its children. */
+struct tms
+ {
+ clock_t tms_utime; /* User CPU time. */
+ clock_t tms_stime; /* System CPU time. */
+
+ clock_t tms_cutime; /* User CPU time of dead children. */
+ clock_t tms_cstime; /* System CPU time of dead children. */
+ };
+
+/* Store the CPU time used by this process and all its
+ dead descendents in BUFFER.
+ Return the elapsed real time from an arbitrary point in the
+ past (the bash emulation uses the epoch), or (clock_t) -1 for
+ errors. All times are in CLK_TCKths of a second. */
+extern clock_t times __P((struct tms *buffer));
+
+#endif /* !HAVE_SYS_TIMES_H */
+#endif /* _BASH_SYSTIMES_H */
diff --git a/include/unionwait.h b/include/unionwait.h
new file mode 100644
index 00000000..ae7c7dfc
--- /dev/null
+++ b/include/unionwait.h
@@ -0,0 +1,98 @@
+/* unionwait.h -- definitions for using a `union wait' on systems without
+ one. */
+
+/* Copyright (C) 1996 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 2, 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, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+#ifndef _UNIONWAIT_H
+#define _UNIONWAIT_H
+
+#if !defined (WORDS_BIGENDIAN)
+union wait
+ {
+ int w_status; /* used in syscall */
+
+ /* Terminated process status. */
+ struct
+ {
+ unsigned short
+ w_Termsig : 7, /* termination signal */
+ w_Coredump : 1, /* core dump indicator */
+ w_Retcode : 8, /* exit code if w_termsig==0 */
+ w_Fill1 : 16; /* high 16 bits unused */
+ } w_T;
+
+ /* Stopped process status. Returned
+ only for traced children unless requested
+ with the WUNTRACED option bit. */
+ struct
+ {
+ unsigned short
+ w_Stopval : 8, /* == W_STOPPED if stopped */
+ w_Stopsig : 8, /* actually zero on XENIX */
+ w_Fill2 : 16; /* high 16 bits unused */
+ } w_S;
+ };
+
+#else /* WORDS_BIGENDIAN */
+
+/* This is for big-endian machines like the IBM RT, HP 9000, or Sun-3 */
+
+union wait
+ {
+ int w_status; /* used in syscall */
+
+ /* Terminated process status. */
+ struct
+ {
+ unsigned short w_Fill1 : 16; /* high 16 bits unused */
+ unsigned w_Retcode : 8; /* exit code if w_termsig==0 */
+ unsigned w_Coredump : 1; /* core dump indicator */
+ unsigned w_Termsig : 7; /* termination signal */
+ } w_T;
+
+ /* Stopped process status. Returned
+ only for traced children unless requested
+ with the WUNTRACED option bit. */
+ struct
+ {
+ unsigned short w_Fill2 : 16; /* high 16 bits unused */
+ unsigned w_Stopsig : 8; /* signal that stopped us */
+ unsigned w_Stopval : 8; /* == W_STOPPED if stopped */
+ } w_S;
+ };
+
+#endif /* WORDS_BIGENDIAN */
+
+#define w_termsig w_T.w_Termsig
+#define w_coredump w_T.w_Coredump
+#define w_retcode w_T.w_Retcode
+#define w_stopval w_S.w_Stopval
+#define w_stopsig w_S.w_Stopsig
+
+#define WSTOPPED 0177
+#define WIFSTOPPED(x) ((x).w_stopval == WSTOPPED)
+#define WIFEXITED(x) ((x).w_stopval != WSTOPPED && (x).w_termsig == 0)
+#define WIFSIGNALED(x) ((x).w_stopval != WSTOPPED && (x).w_termsig != 0)
+
+#define WTERMSIG(x) ((x).w_termsig)
+#define WSTOPSIG(x) ((x).w_stopsig)
+#define WEXITSTATUS(x) ((x).w_retcode)
+#define WIFCORED(x) ((x).w_coredump)
+
+#endif /* _UNIONWAIT_H */