]> git.mdlowis.com Git - proto/rc.git/commitdiff
removed some defines from config.h and ifdefs throughout the code. This fork intends...
authorMichael D. Lowis <mike.lowis@gentex.com>
Mon, 13 Mar 2017 20:16:33 +0000 (16:16 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Mon, 13 Mar 2017 20:16:33 +0000 (16:16 -0400)
20 files changed:
Makefile
addon.c [deleted file]
addon.h [deleted file]
builtins.c
config.h
exec.c
execve.c [deleted file]
fn.c
getgroups.h [deleted file]
glob.c
glom.c
jbwrap.h
print.c
proto.h
rc.h
rlimit.h
signal.c
stat.h [deleted file]
wait.h
which.c

index 68909c5f8df29cb832fcc818f3b9f061de47dc73..97be0b1cc24c56f45fc2c056307006838940be4c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-CPPFLAGS = -DHAVE_CONFIG_H -I.
+CPPFLAGS = -I.
 CCCMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS)
 RCOBJS = builtins.o except.o builtins.o except.o exec.o fn.o footobar.o getopt.o glob.o glom.o hash.o heredoc.o input.o lex.o list.o main.o match.o nalloc.o open.o parse.o print.o redir.o signal.o status.o tree.o utils.o var.o wait.o walk.o which.o sigmsgs.o edit-null.o system.o
 
@@ -20,4 +20,4 @@ rc: $(RCOBJS)
        $(CCCMD)
 
 clean:
-       $(RM) rc *.o
+       $(RM) rc *.o mksignal mkstatval sigmsgs.* statval.h
diff --git a/addon.c b/addon.c
deleted file mode 100644 (file)
index 6e6c232..0000000
--- a/addon.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
-   This file is NOT BUILT by default.  Together with addon.h, it
-   provides an example of how to add new builtins to rc.
-*/
-
-#include "rc.h"
-#include "addon.h"
-
-void b_sum(char **av) {
-       long sum = 0;
-
-       while (*++av)
-               sum += atol(*av);
-       fprint(1, "%ld\n", sum);
-       set(TRUE);
-}
-
-void b_prod(char **av) {
-       long sum = 1;
-
-       while (*++av)
-               sum *= atol(*av);
-       fprint(1, "%ld\n", sum);
-       set(TRUE);
-}
diff --git a/addon.h b/addon.h
deleted file mode 100644 (file)
index 4a69375..0000000
--- a/addon.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-   This file is NOT BUILT by default.  Together with addon.c, it
-   provides an example of how to add new builtins to rc.
-
-   To define a new builtin, it must appear in the macro ADDONS, which
-   is a comma-separated list of pairs of function pointers (the
-   implementation of the new builtin) and string literals (the name of
-   the new builtin).
-
-   Any new builtin functions must also have proper prototypes in this
-   file.  This is always of the same form.
-
-       void b_NAME(char **av);
-
-   The first argument, av[0], is the name of the builtin.  The last
-   argument is followed by a NULL pointer.
-
-   Builtins report their exit status using set(TRUE) or set(FALSE).
-
-*/
-
-#if RC_ADDON
-
-#define ADDONS \
-       { b_sum,        "+" }, \
-       { b_prod, "x" },
-
-extern void b_sum(char **av);
-extern void b_prod(char **av);
-
-#endif
index 75ac9cf46273b94a526059bcf0a7a4c10f361784..cd137c19408ca864a4e745f1867853641132691b 100644 (file)
@@ -14,7 +14,6 @@
 #include <setjmp.h>
 #include <errno.h>
 
-#include "addon.h"
 #include "input.h"
 #include "jbwrap.h"
 #include "rlimit.h"
 
 static void b_break(char **), b_cd(char **), b_eval(char **), b_exit(char **),
        b_newpgrp(char **), b_return(char **), b_shift(char **), b_umask(char **),
-       b_wait(char **), b_whatis(char **);
-
-#if HAVE_SETRLIMIT
-static void b_limit(char **);
-#endif
-
-#if RC_ECHO
-static void b_echo(char **);
-#endif
+       b_wait(char **), b_whatis(char **), b_limit(char **), b_echo(char **);
 
 static struct {
        builtin_t *p;
        char *name;
 } builtins[] = {
-       { b_break,      "break" },
-       { b_builtin,    "builtin" },
-       { b_cd,         "cd" },
-#if RC_ECHO
-       { b_echo,       "echo" },
-#endif
-       { b_eval,       "eval" },
-       { b_exec,       "exec" },
-       { b_exit,       "exit" },
-#if HAVE_SETRLIMIT
-       { b_limit,      "limit" },
-#endif
-       { b_newpgrp,    "newpgrp" },
-       { b_return,     "return" },
-       { b_shift,      "shift" },
-       { b_umask,      "umask" },
-       { b_wait,       "wait" },
-       { b_whatis,     "whatis" },
-       { b_dot,        "." },
-#ifdef ADDONS
-       ADDONS
-#endif
+       { b_break,       "break" },
+       { b_builtin, "builtin" },
+       { b_cd,          "cd" },
+       { b_echo,        "echo" },
+       { b_eval,        "eval" },
+       { b_exec,        "exec" },
+       { b_exit,        "exit" },
+       { b_limit,       "limit" },
+       { b_newpgrp, "newpgrp" },
+       { b_return,      "return" },
+       { b_shift,       "shift" },
+       { b_umask,       "umask" },
+       { b_wait,        "wait" },
+       { b_whatis,      "whatis" },
+       { b_dot,         "." },
 };
 
 extern builtin_t *isbuiltin(char *s) {
@@ -102,7 +86,6 @@ static void badnum(char *num) {
 extern void b_exec(char **ignore) {
 }
 
-#if RC_ECHO
 /* echo -n omits a newline. echo -- -n echos '-n' */
 
 static void b_echo(char **av) {
@@ -116,7 +99,6 @@ static void b_echo(char **av) {
        fprint(1, format, av);
        set(TRUE);
 }
-#endif
 
 /* cd. traverse $cdpath if the directory given is not an absolute pathname */
 
@@ -418,7 +400,6 @@ static void b_newpgrp(char **av) {
 
 /* Berkeley limit support was cleaned up by Paul Haahr. */
 
-#if HAVE_SETRLIMIT
 static const struct Suffix
        kbsuf = { NULL, 1024, "k" },
        mbsuf = { &kbsuf, 1024*1024, "m" },
@@ -555,4 +536,3 @@ static void b_limit(char **av) {
                        set(TRUE);
        }
 }
-#endif
index 98230a1f3ab1fa95cffd99ab8e2cd5ab3943bf0b..746e37477dbfe999be731e5b34a4a7df35e4bf05 100644 (file)
--- a/config.h
+++ b/config.h
-/* config.h.  Generated from config.h.in by configure.  */
-/* config.h.in.  Generated from configure.ac by autoheader.  */
-
 /* The default interpreter */
 #define DEFAULTINTERP "/bin/sh"
 
 /* The default path */
 #define DEFAULTPATH "/usr/local/bin","/usr/bin","/bin","."
 
-/* Define to the type of elements in the array set by `getgroups'. Usually
-   this is either `int' or `gid_t'. */
-#define GETGROUPS_T gid_t
-
-/* Define to 1 if your kernel understands `#!' magic numbers */
-#define HASH_BANG 1
-
-/* Define to 1 if you have /dev/fd. */
-#define HAVE_DEV_FD 1
-
-/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
-   */
-#define HAVE_DIRENT_H 1
-
-/* Define to 1 if you have the `mkfifo' function. */
-/* #undef HAVE_FIFO */
-
-/* Define to 1 if you have the `getgroups' function. */
-#define HAVE_GETGROUPS 1
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#define HAVE_INTTYPES_H 1
-
-/* Define to 1 if you have the `lstat' function. */
-#define HAVE_LSTAT 1
-
-/* Define to 1 if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
-
-/* Define to 1 if you have the `mkfifo' function. */
-/* #undef HAVE_MKFIFO */
-
-/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
-/* #undef HAVE_NDIR_H */
-
-/* Define to 1 if you have the `getgroups' function with POSIX semantics. */
-#define HAVE_POSIX_GETGROUPS 1
-
-/* Define to 1 if you have /proc/self/fd. */
-/* #undef HAVE_PROC_SELF_FD */
-
-/* Define to 1 if you have the `quad_t' type. */
-/* #undef HAVE_QUAD_T */
-
-/* Define to 1 if system calls automatically restart after interruption by a
-   signal. */
-/* #undef HAVE_RESTARTABLE_SYSCALLS */
-
-/* Define to 1 if you have the `rlim_t' type. */
-#define HAVE_RLIM_T 1
-
-/* Define to 1 if you have the `setpgrp' function. */
-#define HAVE_SETPGRP 1
-
-/* Define to 1 if you have the `setrlimit' function. */
-#define HAVE_SETRLIMIT 1
-
-/* Define to 1 if you have the `sigaction' function. */
-#define HAVE_SIGACTION 1
-
-/* Define to 1 if you have the `sigsetjmp' function or macro. */
-#define HAVE_SIGSETJMP 1
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#define HAVE_STDINT_H 1
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define to 1 if you have the `strerror' function or macro. */
-#define HAVE_STRERROR 1
-
-/* Define to 1 if you have the <strings.h> header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define to 1 if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Has SysV SIGCLD */
-#define HAVE_SYSV_SIGCLD 1
-
-/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
-   */
-/* #undef HAVE_SYS_DIR_H */
-
-/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
-   */
-/* #undef HAVE_SYS_NDIR_H */
-
-/* Define to 1 if you have the <sys/resource.h> header file. */
-#define HAVE_SYS_RESOURCE_H 1
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#define HAVE_SYS_STAT_H 1
-
-/* Define to 1 if you have the <sys/time.h> header file. */
-#define HAVE_SYS_TIME_H 1
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
-#define HAVE_SYS_WAIT_H 1
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1
-
 /* Name of package */
 #define PACKAGE "rc"
 
-/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT ""
-
-/* Define to the full name of this package. */
-#define PACKAGE_NAME "rc"
-
-/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "rc 1.7.4"
-
-/* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME "rc"
-
-/* Define to the home page for this package. */
-#define PACKAGE_URL ""
-
-/* Define to the version of this package. */
-#define PACKAGE_VERSION "1.7.4"
-
 /* Define to 1 to encode exported environment names. */
 #define PROTECT_ENV 1
 
-/* Define to 1 to use addon functions. */
-/* #undef RC_ADDON */
-
-/* Define to 1 to include `echo' as a builtin. */
-#define RC_ECHO 1
-
 /* Define to 1 to use job-control-style backgrounding. */
 #define RC_JOB 1
 
 /* Release date */
 #define RELDATE "2017-03-13"
 
-/* Define to 1 if `_KERNEL' must be defined for `RLIMIT_*' macros. */
-/* #undef RLIMIT_NEEDS_KERNEL */
-
-/* Define to 1 if `rlim_t' is `quad_t'. */
-/* #undef RLIM_T_IS_QUAD_T */
-
-/* Define to 1 if the `setpgrp' function takes no argument. */
-#define SETPGRP_VOID 1
-
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
 /* Version number of package */
 #define VERSION "1.7.4"
 
-/* Enable large inode numbers on Mac OS X 10.5.  */
-#ifndef _DARWIN_USE_64_BIT_INODE
-# define _DARWIN_USE_64_BIT_INODE 1
-#endif
-
-/* Number of bits in a file offset, on hosts where this is settable. */
-/* #undef _FILE_OFFSET_BITS */
-
-/* Define for large files, on AIX-style hosts. */
-/* #undef _LARGE_FILES */
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-/* #undef gid_t */
-
-/* Define to `int' if <sys/types.h> does not define. */
-/* #undef pid_t */
-
-/* Define to 1 if you have the `sig_atomic_t' type. */
-/* #undef sig_atomic_t */
-
-/* Define to `unsigned int' if <sys/types.h> does not define. */
-/* #undef size_t */
-
-/* Define to `long' if <sys/types.h> does not define. */
-/* #undef ssize_t */
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-/* #undef uid_t */
diff --git a/exec.c b/exec.c
index c9244c244aa09502d25532b018e2b1246ae2f022..08116e0f2eae71e8fa36f09d9e4f85fd809f6633 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -94,7 +94,7 @@ extern void exec(List *s, bool parent) {
                                return;
                        rc_exit(getstatus());
                }
-               rc_execve(path, (char * const *) av, (char * const *) ev);
+               execve(path, (char * const *) av, (char * const *) ev);
 
 #ifdef DEFAULTINTERP
                if (errno == ENOEXEC) {
diff --git a/execve.c b/execve.c
deleted file mode 100644 (file)
index 5edde11..0000000
--- a/execve.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* execve.c: an execve() for geriatric unices without #! */
-
-/*
-   NOTE: this file depends on a hack in footobar.c which places two free
-   spots before av[][] so that execve does not have to call malloc.
-*/
-
-#include "rc.h"
-
-#include <errno.h>
-
-#define giveupif(x) { if (x) goto fail; }
-
-extern int rc_execve(char *path, char **av, char **ev) {
-       int fd, len, fst, snd, end;
-       bool noarg;
-       char pb[256]; /* arbitrary but generous limit */
-       execve(path, av, ev);
-       if (errno != ENOEXEC)
-               return -1;
-       fd = rc_open(path, rFrom);
-       giveupif(fd < 0);
-       len = read(fd, pb, sizeof pb);
-       close(fd);
-       /* reject scripts which don't begin with #! */
-       giveupif(len <= 0 || pb[0] != '#' || pb[1] != '!');
-       for (fst = 2; fst < len && (pb[fst] == ' ' || pb[fst] == '\t'); fst++)
-               ; /* skip leading whitespace */
-       giveupif(fst == len);
-       for (snd = fst; snd < len && pb[snd] != ' ' && pb[snd] != '\t' && pb[snd] != '\n'; snd++)
-               ; /* skip first arg */
-       giveupif(snd == len);
-       noarg = (pb[snd] == '\n');
-       pb[snd++] = '\0'; /* null terminate the first arg */
-       if (!noarg) {
-               while (snd < len && (pb[snd] == ' ' || pb[snd] == '\t'))
-                       snd++; /* skip whitespace to second arg */
-               giveupif(snd == len);
-               noarg = (pb[snd] == '\n'); /* could have trailing whitespace after only one arg */
-               if (!noarg) {
-                       for (end = snd; end < len && pb[end] != ' ' && pb[end] != '\t' && pb[end] != '\n'; end++)
-                               ; /* skip to the end of the second arg */
-                       giveupif(end == len);
-                       if (pb[end] == '\n') {
-                               pb[end] = '\0'; /* null terminate the first arg */
-                       } else {                /* else check for a spurious third arg */
-                               pb[end++] = '\0';
-                               while (end < len && (pb[end] == ' ' || pb[end] == '\t'))
-                                       end++;
-                               giveupif(end == len || pb[end] != '\n');
-                       }
-               }
-       }
-       *av = path;
-       if (!noarg)
-               *--av = pb + snd;
-       *--av = pb + fst;
-       execve(*av, av, ev);
-       return -1;
-fail:  errno = ENOEXEC;
-       return -1;
-}
diff --git a/fn.c b/fn.c
index 7d9e4f796e38ff73af24cdfbadc035e5963e63d5..2aa6f9d8d1415b53f3b4804ff697fd9615840486 100644 (file)
--- a/fn.c
+++ b/fn.c
@@ -29,9 +29,6 @@ extern void inithandler() {
        null.type = nBody;
        null.u[0].p = null.u[1].p = NULL;
        for (i = 1; i < NUMOFSIGNALS; i++)
-#if HAVE_SYSV_SIGCLD
-               if (i != SIGCLD)
-#endif
                if (sighandlers[i] == SIG_IGN)
                        fnassign(signals[i].name, NULL); /* ignore incoming ignored signals */
        if (interactive || sighandlers[SIGINT] != SIG_IGN) {
@@ -151,10 +148,6 @@ extern void fnassign(char *name, Node *def) {
        new->def = newdef;
        new->extdef = NULL;
        if (strncmp(name, "sig", conststrlen("sig")) == 0) { /* slight optimization */
-#if HAVE_SYSV_SIGCLD /* System V machines treat SIGCLD very specially */
-               if (streq(name, "sigcld"))
-                       rc_error("can't trap SIGCLD");
-#endif
                if (streq(name, "sigexit"))
                        runexit = TRUE;
                for (i = 1; i < NUMOFSIGNALS; i++) /* zero is a bogus signal */
diff --git a/getgroups.h b/getgroups.h
deleted file mode 100644 (file)
index 982dfa0..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#if HAVE_GETGROUPS
-#if HAVE_POSIX_GETGROUPS
-/* We love POSIX. */
-#else
-/* OK, so you've got getgroups, but you don't have the POSIX semantics
-of a zero first argument.  The conclusion is that you're on a reasonably
-pure BSD system, and we can include <sys/param.h> for NGROUPS. */
-#include <sys/param.h>
-#endif
-#endif
diff --git a/glob.c b/glob.c
index 55076786830f0730e8dbda2a42fc3d55fbe414f6..18f62f473f8e741a900b2d02a92b5a5c2674d2f3 100644 (file)
--- a/glob.c
+++ b/glob.c
@@ -1,25 +1,11 @@
 /* glob.c: rc's (ugly) globber. This code is not elegant, but it works */
 
 #include "rc.h"
-#include "stat.h"
+#include <sys/stat.h>
 
 /* Lifted from autoconf documentation.*/
-#if HAVE_DIRENT_H
-# include <dirent.h>
-# define NAMLEN(dirent) strlen((dirent)->d_name)
-#else
-# define dirent direct
-# define NAMLEN(dirent) (dirent)->d_namlen
-# if HAVE_SYS_NDIR_H
-#  include <sys/ndir.h>
-# endif
-# if HAVE_SYS_DIR_H
-#  include <sys/dir.h>
-# endif
-# if HAVE_NDIR_H
-#  include <ndir.h>
-# endif
-#endif
+#include <dirent.h>
+#define NAMLEN(dirent) strlen((dirent)->d_name)
 
 static List *dmatch(char *, char *, char *);
 static List *doglob(char *, char *);
diff --git a/glom.c b/glom.c
index c44f0d56fe3b2d145fd7d0322e5a0461854c0b77..2414f9f912b5ce311383b12960fdebfc863dadd7 100644 (file)
--- a/glom.c
+++ b/glom.c
@@ -286,50 +286,6 @@ extern void qredir(Node *n) {
        next->n = NULL;
 }
 
-#if HAVE_DEV_FD || HAVE_PROC_SELF_FD
-static List *mkcmdarg(Node *n) {
-       char *name;
-       List *ret = nnew(List);
-       Estack *e = nnew(Estack);
-       Edata efd;
-       int p[2];
-       if (pipe(p) < 0) {
-               uerror("pipe");
-               return NULL;
-       }
-       if (rc_fork() == 0) {
-               setsigdefaults(FALSE);
-               if (mvfd(p[n->u[0].i == rFrom], n->u[0].i == rFrom) < 0) /* stupid hack */
-                       exit(1);
-               close(p[n->u[0].i != rFrom]);
-               redirq = NULL;
-               walk(n->u[2].p, FALSE);
-               exit(getstatus());
-       }
-
-#if HAVE_DEV_FD
-       name = nprint("/dev/fd/%d", p[n->u[0].i != rFrom]);
-#else
-       name = nprint("/proc/self/fd/%d", p[n->u[0].i != rFrom]);
-#endif
-
-       efd.fd = p[n->u[0].i != rFrom];
-       except(eFd, efd, e);
-       close(p[n->u[0].i == rFrom]);
-       ret->w = name;
-       ret->m = NULL;
-       ret->n = NULL;
-       return ret;
-}
-
-#elif HAVE_FIFO
-
-#if HAVE_MKFIFO
-/* Have POSIX mkfifo(). */
-#else
-#define mkfifo(n,m) mknod(n, S_IFIFO | m, 0)
-#endif
-
 static List *mkcmdarg(Node *n) {
        int fd;
        char *name;
@@ -364,15 +320,6 @@ static List *mkcmdarg(Node *n) {
        return ret;
 }
 
-#else
-
-static List *mkcmdarg(Node *n) {
-       rc_error("command arguments are not supported");
-       return NULL;
-}
-
-#endif
-
 extern List *glom(Node *n) {
        List *v, *head, *tail;
        Node *words;
index 4b3ea8658c4ac1d39817bbf4829386dc20aac317..f8d34e0175f474f66ead2909eb1c160f493a3657 100644 (file)
--- a/jbwrap.h
+++ b/jbwrap.h
@@ -5,14 +5,6 @@ use a jmp_buf.  This probably fails on a traditional SysV machine, where
 jmp_bufs don't preserve signal masks.  I'm not worrying about this till
 someone reports it as a bug :-). */
 
-#if HAVE_SIGSETJMP
-#else
-#define sigjmp_buf jmp_buf
-#define sigsetjmp(x,y) setjmp(x)
-#define siglongjmp longjmp
-#endif /* HAVE_SIGSETJMP */
-
-
 /* Certain braindamaged environments don't define jmp_buf as an array,
 so wrap it in a structure.  Potentially, we could use configure to do
 this only where it needs to be done, but the effort is probably not
diff --git a/print.c b/print.c
index 2a30b5c593db6b38222e45ef71bfa4e29e8a44e1..6309e876a238907a8155f7f76d10daf12767c310 100644 (file)
--- a/print.c
+++ b/print.c
@@ -19,13 +19,9 @@ static bool name(Format *format, int ignore) { \
        return TRUE; \
 }
 
-Flag(uconv,    FMT_unsigned)
+Flag(uconv,        FMT_unsigned)
 Flag(rc_lconv, FMT_long)
-
-#if HAVE_QUAD_T
-Flag(qconv,    FMT_quad)
-#endif
-
+Flag(qconv,        FMT_quad)
 Flag(altconv,  FMT_altform)
 Flag(leftconv, FMT_leftside)
 Flag(dotconv,  FMT_f2set)
@@ -94,12 +90,6 @@ static void intconv(Format *format, unsigned int radix, int upper, const char *a
 
        flags = format->flags;
 
-#if HAVE_QUAD_T
-       if (flags & FMT_quad)
-               n = va_arg(format->args, quad_t);
-       else
-#endif
-
        if (flags & FMT_long)
                n = va_arg(format->args, long);
        else
@@ -204,10 +194,6 @@ static void inittab(void) {
        fmttab['-'] = leftconv;
        fmttab['.'] = dotconv;
 
-#if HAVE_QUAD_T
-       fmttab['q'] = qconv;
-#endif
-
        fmttab['0'] = zeroconv;
        for (i = '1'; i <= '9'; i++)
                fmttab[i] = digitconv;
diff --git a/proto.h b/proto.h
index 4a2d74a4bd1e6b30d9b1da3c707b961bc1297d6f..34a8a684d006769c44f7edbf107c2d4c82d611ab 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -4,17 +4,11 @@
   file, or---for older systems---declaring the functions directly.
 */
 
-#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
-#endif
 
 #include <signal.h>
 
-#if HAVE_QUAD_T
-typedef quad_t align_t;
-#else
 typedef long align_t;
-#endif
 
 /*
   We need <stdarg.h>.  If you really need to build rc on a system which
@@ -30,71 +24,7 @@ assignment works. */
 #define va_copy(x,y) (x)=(y)
 #endif
 
-#if STDC_HEADERS
-
 #include <stdlib.h>
 #include <string.h>
-
-#else /* STDC_HEADERS */
-
-/* fake string.h */
-extern int strncmp(const char *, const char *, size_t);
-extern int strcmp(const char *, const char *);
-extern size_t strlen(const char *);
-extern char *strchr(const char *, int);
-extern char *strrchr(const char *, int);
-extern char *strcpy(char *, const char *);
-extern char *strncpy(char *, const char *, size_t);
-extern char *strcat(char *, const char *);
-extern char *strncat(char *, const char *, size_t);
-extern void *memcpy(void *, const void *, size_t);
-extern void *memset(void *, int, size_t);
-
-/* fake stdlib.h */
-extern void exit(int);
-extern void free(void *);
-extern void *malloc(size_t);
-extern void *realloc(void *, size_t);
-extern void qsort(void *, size_t, size_t, int (*)(const void *, const void *));
-
-#endif /* STDC_HEADERS */
-
-#if HAVE_STRERROR
-/* Smells like POSIX. */
-#else
-/* Assume BSD-style sys_errlist[]. */
-extern int sys_nerr;
-extern char *sys_errlist[];
-#define strerror(x) ((0 <= (x)) && (errno < (x)) ? sys_errlist[x] : (char *)0)
-#endif
-
-#if HAVE_UNISTD_H
 #include <unistd.h>
-#endif
-
-#if HAVE_SETPGRP
-
-#if SETPGRP_VOID
-/* Smells like POSIX: should all be ok. */
-#else
-/* Old BSD: fake it. */
-#define setpgid(pid, pgrp) setpgrp(pid, pgrp)
-#include <sys/ioctl.h>
-#define tcgetpgrp(fd) ioctl((fd), TIOCGPGRP)
-#define tcsetpgrp(fd, pgrp) ioctl((fd), TIOCSPGRP, &(pgrp))
-#endif
-
-#else /* HAVE_SETPGRP */
 
-/* Nothing doing. */
-#define setpgid()
-#define tcgetpgrp()
-#define tcsetpgrp()
-
-#endif /*HAVE_SETPGRP */
-
-
-/* fake errno.h for mips (which doesn't declare errno in errno.h!?!?) */
-#ifdef host_mips
-extern int errno;
-#endif
diff --git a/rc.h b/rc.h
index 2912e60054eb3dc886a14db2ede38c2ea01d0c67..9769e0117e44994673dabf6ad2b270df3950a4ac 100644 (file)
--- a/rc.h
+++ b/rc.h
@@ -192,13 +192,6 @@ extern void sigint(int);
 /* exec.c */
 extern void exec(List *, bool);
 
-#if HASH_BANG
-#define rc_execve execve
-#else
-/* execve.c */
-extern int my_execve(char *, char **, char **);
-#endif
-
 /* footobar.c */
 extern char **list2array(List *, bool);
 extern char *get_name(char *);
index a3dbe8d521814db7d4df1576867a095cec61df3f..1486bd75da487fd0a089044518c9941d9619f276 100644 (file)
--- a/rlimit.h
+++ b/rlimit.h
@@ -1,39 +1,14 @@
 /* What a mess.  This file attempts to straighten everything out. */
 
-#if HAVE_SETRLIMIT
-
-#if HAVE_SYS_RESOURCE_H
 #include <sys/time.h>
-#if RLIMIT_NEEDS_KERNEL
-#define _KERNEL
-#endif
 #include <sys/resource.h>
-#if RLIMIT_NEEDS_KERNEL
-#undef _KERNEL
-#endif
-#else
-#include <sys/times.h>
-#endif
 
 #if HAVE_LIMITS_H
 #include <limits.h>
 #endif
 
-#ifndef HAVE_RLIM_T
-#if RLIM_T_IS_QUAD_T
-typedef quad_t rlim_t;
-#else
-typedef long rlim_t;
-#endif
-#endif
-
-#if HAVE_QUAD_T
-#define RLIM_CONV quad_t
-#define RLIM_FMT "%s \t%qd%s\n"
-#else
 #define RLIM_CONV long
 #define RLIM_FMT "%s \t%ld%s\n"
-#endif
 
 #if defined(RLIMIT_OFILE) && !defined (RLIMIT_NOFILE)
 #define RLIMIT_NOFILE RLIMIT_OFILE
@@ -50,4 +25,3 @@ struct Limit {
        int flag;
        const struct Suffix *suffix;
 };
-#endif /* HAVE_SETRLIMIT */
index 037be1d8e7c076182a8290c7cb4e57fefd0d392f..f3569e7da6fca4ba0a285b1d915e7121ce16f644 100644 (file)
--- a/signal.c
+++ b/signal.c
@@ -8,7 +8,6 @@
 #include "sigmsgs.h"
 #include "jbwrap.h"
 
-#if HAVE_SIGACTION
 void (*sys_signal(int signum, void (*handler)(int)))(int) {
        struct sigaction new, old;
 
@@ -18,11 +17,6 @@ void (*sys_signal(int signum, void (*handler)(int)))(int) {
        sigaction(signum, &new, &old);
        return old.sa_handler;
 }
-#else
-void (*sys_signal(int signum, void (*handler)(int)))(int) {
-       return signal(signum, handler);
-}
-#endif
 
 void (*sighandlers[NUMOFSIGNALS])(int);
 
@@ -34,12 +28,6 @@ extern void catcher(int s) {
                caught[s] = 1;
        }
        sys_signal(s, catcher);
-
-#if HAVE_RESTARTABLE_SYSCALLS
-       if (slow) {
-               siglongjmp(slowbuf.j, s);
-       }
-#endif
 }
 
 extern void sigchk() {
@@ -82,15 +70,6 @@ extern void initsignal() {
        void (*h)(int);
        int i;
 
-#if HAVE_SYSV_SIGCLD
-       /* Ensure that SIGCLD is not SIG_IGN.  Solaris's rshd does this.  :-( */
-       h = sys_signal(SIGCLD, SIG_IGN);
-       if (h != SIG_IGN && h != SIG_ERR)
-               sys_signal(SIGCLD, h);
-       else
-               sys_signal(SIGCLD, SIG_DFL);
-#endif
-
        for (i = 1; i < NUMOFSIGNALS; i++) {
 #ifdef SIGKILL
                if (i == SIGKILL) continue;
diff --git a/stat.h b/stat.h
deleted file mode 100644 (file)
index 5f87a69..0000000
--- a/stat.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <sys/stat.h>
-
-#if HAVE_LSTAT
-#else
-#define lstat(name, buf) (stat((name), (buf)))
-#endif
diff --git a/wait.h b/wait.h
index e54ae45a02414f2d88fbdd36507a19325db33610..a23ca79d2f9d1382c49b2c632f43a28b96e296de 100644 (file)
--- a/wait.h
+++ b/wait.h
@@ -1,6 +1,4 @@
-#if HAVE_SYS_WAIT_H
 #include <sys/wait.h>
-#endif
 
 /* Fake the POSIX wait() macros if we don't have them. */
 #ifndef WIFEXITED
diff --git a/which.c b/which.c
index 798d7b0ee6d74ece128f8ee57ec90a241eb013e2..3fc3f1ab639c9e7149872a2dd55bd206890654f6 100644 (file)
--- a/which.c
+++ b/which.c
@@ -14,8 +14,6 @@
 #include <errno.h>
 #include <sys/stat.h>
 
-#include "getgroups.h"
-
 #define X_USR 0100
 #define X_GRP 0010
 #define X_OTH 0001
@@ -25,9 +23,8 @@ static bool initialized = FALSE;
 static uid_t uid;
 static gid_t gid;
 
-#if HAVE_GETGROUPS
 static int ngroups;
-static GETGROUPS_T *gidset;
+static gid_t* gidset;
 
 /* determine whether gid lies in gidset */
 
@@ -38,9 +35,6 @@ static int ingidset(gid_t g) {
                        return 1;
        return 0;
 }
-#else
-#define ingidset(g) (FALSE)
-#endif
 
 /*
    A home-grown access/stat. Does the right thing for group-executable files.
@@ -97,21 +91,15 @@ extern char *which(char *name, bool verbose) {
                initialized = TRUE;
                uid = geteuid();
                gid = getegid();
-#if HAVE_GETGROUPS
-#if HAVE_POSIX_GETGROUPS
-               ngroups = getgroups(0, (GETGROUPS_T *)0);
+               ngroups = getgroups(0, (gid_t *)0);
                if (ngroups < 0) {
                        uerror("getgroups");
                        rc_exit(1);
                }
-#else
-               ngroups = NGROUPS;
-#endif
                if (ngroups) {  
-                       gidset = ealloc(ngroups * sizeof(GETGROUPS_T));
+                       gidset = ealloc(ngroups * sizeof(gid_t));
                        getgroups(ngroups, gidset);
                }
-#endif
        }
        if (isabsolute(name)) /* absolute pathname? */
                return rc_access(name, verbose) ? name : NULL;