From 0f622a8610c96bab327bbd5811cc84c4c4d45621 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Wed, 15 Mar 2017 09:06:25 -0400 Subject: [PATCH] general cleanup --- builtins.c | 2 +- config.h | 21 --------------------- rc.h | 42 +++++++++--------------------------------- status.c | 3 +++ 4 files changed, 13 insertions(+), 55 deletions(-) delete mode 100644 config.h diff --git a/builtins.c b/builtins.c index 9c56e40..51cb36f 100644 --- a/builtins.c +++ b/builtins.c @@ -383,7 +383,7 @@ static void printlimit(const struct Limit *limit, bool hard) { lim /= suf->amount; break; } - fprint(1, RLIM_FMT, limit->name, (RLIM_CONV)lim, (suf == NULL || lim == 0) ? "" : suf->name); + fprint(1, "%s \t%ld%s\n", limit->name, (long)lim, (suf == NULL || lim == 0) ? "" : suf->name); } } diff --git a/config.h b/config.h deleted file mode 100644 index 746e374..0000000 --- a/config.h +++ /dev/null @@ -1,21 +0,0 @@ -/* The default interpreter */ -#define DEFAULTINTERP "/bin/sh" - -/* The default path */ -#define DEFAULTPATH "/usr/local/bin","/usr/bin","/bin","." - -/* Name of package */ -#define PACKAGE "rc" - -/* Define to 1 to encode exported environment names. */ -#define PROTECT_ENV 1 - -/* Define to 1 to use job-control-style backgrounding. */ -#define RC_JOB 1 - -/* Release date */ -#define RELDATE "2017-03-13" - -/* Version number of package */ -#define VERSION "1.7.4" - diff --git a/rc.h b/rc.h index 29f51ae..ad9f6cb 100644 --- a/rc.h +++ b/rc.h @@ -1,7 +1,14 @@ #undef NDEBUG #define _XOPEN_SOURCE 700 -#include "config.h" +/* Configuration options */ +#define DEFAULTINTERP "/bin/sh" +#define DEFAULTPATH "/usr/local/bin","/usr/bin","/bin","." +#define PACKAGE "rc" +#define PROTECT_ENV 1 +#define RC_JOB 1 +#define RELDATE "2017-03-13" +#define VERSION "1.7.4" /* C standard includes */ #include @@ -34,17 +41,6 @@ typedef long align_t; #define TRUE true #define FALSE false -/* - wait.h -*/ - -/* These don't exist in POSIX. */ -#define myWIFDUMPED(s) (((s) & 0x80) != 0) - -/* - jbwrap.h -*/ - /* If we have POSIX sigjmp_buf and friends, use them. If we don't, just 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 @@ -59,18 +55,6 @@ struct Jbwrap { sigjmp_buf j; }; -/* - rlimit.h -*/ -/* What a mess. This file attempts to straighten everything out. */ - -#define RLIM_CONV long -#define RLIM_FMT "%s \t%ld%s\n" - -#if defined(RLIMIT_OFILE) && !defined (RLIMIT_NOFILE) -#define RLIMIT_NOFILE RLIMIT_OFILE -#endif - struct Suffix { const struct Suffix *next; long amount; @@ -279,12 +263,6 @@ extern Node *parse_fn(char *); extern void initprint(void); extern void rc_exit(int); /* here for odd reasons; user-defined signal handlers are kept in fn.c */ -/* getopt.c */ -extern int rc_getopt(int, char **, char *); - -extern int rc_optind, rc_opterr, rc_optopt; -extern char *rc_optarg; - /* glob.c */ extern bool lmatch(List *, List *); extern List *glob(List *); @@ -379,6 +357,7 @@ extern void fmtcat(Format *, const char *); extern int fprint(int fd, const char *fmt,...); extern char *mprint(const char *fmt,...); extern char *nprint(const char *fmt,...); +extern void writeall(int, char *, size_t); /* the following macro should by rights be coded as an expression, not a statement, but certain compilers (notably DEC) have trouble with @@ -421,9 +400,6 @@ extern void statprint(pid_t, int); extern void ssetstatus(char **); extern char *strstatus(int s); -/* system.c or system-bsd.c */ -extern void writeall(int, char *, size_t); - /* tree.c */ extern Node *mk(int /*nodetype*/,...); extern Node *treecpy(Node *, void *(*)(size_t)); diff --git a/status.c b/status.c index aa8790c..bdb9af0 100644 --- a/status.c +++ b/status.c @@ -3,6 +3,9 @@ #include "rc.h" #include "statval.h" +/* not defined by posix but useful nonetheless */ +#define myWIFDUMPED(s) (((s) & 0x80) != 0) + /* status == the wait() value of the last command in the pipeline, or the last command */ static int statuses[512]; -- 2.49.0