Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/sh Remove the -X option from SMALL shells (as used on bo...
details: https://anonhg.NetBSD.org/src/rev/bb3f7d70ecaf
branches: trunk
changeset: 357673:bb3f7d70ecaf
user: kre <kre%NetBSD.org@localhost>
date: Tue Nov 21 03:42:39 2017 +0000
description:
Remove the -X option from SMALL shells (as used on boot floppies,
some other install media, mini-roots, etc.) It is unlikely that
such a shell will be used for much script debugging (and the old -x
still exists of course) and it adds a little bloat, so, zap...
The ancient unused (unrelated) xioctl() function is gone as well
(from all shells).
diffstat:
bin/sh/option.list | 4 ++--
bin/sh/options.c | 10 ++++++++--
bin/sh/output.c | 39 +++++++++++++++++++--------------------
bin/sh/output.h | 22 +++++++++++++++++++---
4 files changed, 48 insertions(+), 27 deletions(-)
diffs (232 lines):
diff -r 284b43877de9 -r bb3f7d70ecaf bin/sh/option.list
--- a/bin/sh/option.list Tue Nov 21 03:09:41 2017 +0000
+++ b/bin/sh/option.list Tue Nov 21 03:42:39 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: option.list,v 1.7 2017/11/19 03:23:01 kre Exp $ */
+/* $NetBSD: option.list,v 1.8 2017/11/21 03:42:39 kre Exp $ */
/*
* define the shell's settable options
@@ -66,7 +66,7 @@
fnline1 local_lineno L on # number lines in funcs starting at 1
promptcmds promptcmds # allow $( ) in PS1 (et al).
pipefail pipefail # pipe exit status
-Xflag Xtrace X # sticky stderr for -x (implies -x)
+Xflag Xtrace X #ifndef SMALL # sticky stderr for -x (implies -x)
// editline/history related options ("vi" is standard, 'V' and others are not)
// only one of vi/emacs can be set, hence the "set" definition, value
diff -r 284b43877de9 -r bb3f7d70ecaf bin/sh/options.c
--- a/bin/sh/options.c Tue Nov 21 03:09:41 2017 +0000
+++ b/bin/sh/options.c Tue Nov 21 03:42:39 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: options.c,v 1.51 2017/11/19 03:23:01 kre Exp $ */
+/* $NetBSD: options.c,v 1.52 2017/11/21 03:42:39 kre Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: options.c,v 1.51 2017/11/19 03:23:01 kre Exp $");
+__RCSID("$NetBSD: options.c,v 1.52 2017/11/21 03:42:39 kre Exp $");
#endif
#endif /* not lint */
@@ -252,8 +252,10 @@
if (optlist[j].opt_set == flag)
optlist[j].val = 0;
}
+#ifndef SMALL
if (i == _SH_OPT_Xflag)
xtracefdsetup(val);
+#endif
optlist[i].val = val;
#ifdef DEBUG
if (&optlist[i].val == &debug)
@@ -309,8 +311,10 @@
for (i = 0; i < NOPTS; i++)
if (optlist[i].name && equal(name, optlist[i].name)) {
set_opt_val(i, val);
+#ifndef SMALL
if (i == _SH_OPT_Xflag)
set_opt_val(_SH_OPT_xflag, val);
+#endif
return;
}
error("Illegal option %co %s", "+-"[val], name);
@@ -326,8 +330,10 @@
for (i = 0; i < NOPTS; i++)
if (optlist[i].letter == flag) {
set_opt_val(i, val);
+#ifndef SMALL
if (i == _SH_OPT_Xflag)
set_opt_val(_SH_OPT_xflag, val);
+#endif
return;
}
error("Illegal option %c%c", "+-"[val], flag);
diff -r 284b43877de9 -r bb3f7d70ecaf bin/sh/output.c
--- a/bin/sh/output.c Tue Nov 21 03:09:41 2017 +0000
+++ b/bin/sh/output.c Tue Nov 21 03:42:39 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: output.c,v 1.39 2017/11/19 03:23:01 kre Exp $ */
+/* $NetBSD: output.c,v 1.40 2017/11/21 03:42:39 kre Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)output.c 8.2 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: output.c,v 1.39 2017/11/19 03:23:01 kre Exp $");
+__RCSID("$NetBSD: output.c,v 1.40 2017/11/21 03:42:39 kre Exp $");
#endif
#endif /* not lint */
@@ -76,15 +76,23 @@
#define BLOCK_OUT -2 /* output to a fixed block of memory */
#define MEM_OUT -3 /* output to dynamically allocated memory */
+#ifdef SMALL
+#define CHAIN
+#else
+#define CHAIN ,NULL
+#endif
+
/* nextc nleft bufsize buf fd flags chain */
-struct output output = {NULL, 0, OUTBUFSIZ, NULL, 1, 0, NULL };
-struct output errout = {NULL, 0, 100, NULL, 2, 0, NULL };
-struct output memout = {NULL, 0, 0, NULL, MEM_OUT, 0, NULL };
+struct output output = {NULL, 0, OUTBUFSIZ, NULL, 1, 0 CHAIN };
+struct output errout = {NULL, 0, 100, NULL, 2, 0 CHAIN };
+struct output memout = {NULL, 0, 0, NULL, MEM_OUT, 0 CHAIN };
struct output *out1 = &output;
struct output *out2 = &errout;
+#ifndef SMALL
struct output *outx = &errout;
struct output *outxtop = NULL;
+#endif
#ifdef mkinit
@@ -133,11 +141,13 @@
outstr(p, out2);
}
+#ifndef SMALL
void
outxstr(const char *p)
{
outstr(p, outx);
}
+#endif
void
@@ -158,11 +168,13 @@
outshstr(p, out2);
}
+#ifndef SMALL
void
outxshstr(const char *p)
{
outshstr(p, outx);
}
+#endif
/*
* ' is in this list, not because it does not require quoting
@@ -614,21 +626,7 @@
return nbytes;
}
-
-/*
- * Version of ioctl that retries after a signal is caught.
- * XXX unused function
- */
-
-int
-xioctl(int fd, unsigned long request, char *arg)
-{
- int i;
-
- while ((i = ioctl(fd, request, arg)) == -1 && errno == EINTR);
- return i;
-}
-
+#ifndef SMALL
static void
xtrace_fd_swap(int from, int to)
{
@@ -754,3 +752,4 @@
CTRACE(DBG_OUTPUT, ("-> fd=%d buf=%p nleft=%d flags=%x\n",
outx->fd, outx->buf, outx->nleft, outx->flags));
}
+#endif /* SMALL */
diff -r 284b43877de9 -r bb3f7d70ecaf bin/sh/output.h
--- a/bin/sh/output.h Tue Nov 21 03:09:41 2017 +0000
+++ b/bin/sh/output.h Tue Nov 21 03:42:39 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: output.h,v 1.26 2017/11/19 03:23:01 kre Exp $ */
+/* $NetBSD: output.h,v 1.27 2017/11/21 03:42:39 kre Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -45,7 +45,9 @@
char *buf;
short fd;
short flags;
+#ifndef SMALL
struct output *chain;
+#endif
};
/* flags for ->flags */
@@ -57,15 +59,24 @@
extern struct output memout;
extern struct output *out1;
extern struct output *out2;
+#ifdef SMALL
+#define outx out2
+#else
extern struct output *outx;
+#endif
void open_mem(char *, int, struct output *);
void out1str(const char *);
void out2str(const char *);
-void outxstr(const char *);
void outstr(const char *, struct output *);
void out2shstr(const char *);
+#ifdef SMALL
+#define outxstr out2str
+#define outxshstr out2shstr
+#else
+void outxstr(const char *);
void outxshstr(const char *);
+#endif
void outshstr(const char *, struct output *);
void emptyoutbuf(struct output *);
void flushall(void);
@@ -79,10 +90,15 @@
void fmtstr(char *, size_t, const char *, ...) __printflike(3, 4);
void doformat(struct output *, const char *, va_list) __printflike(2, 0);
int xwrite(int, char *, int);
-int xioctl(int, unsigned long, char *);
+#ifdef SMALL
+#define xtracefdsetup(x) do { break; } while (0)
+#define xtrace_clone(x) do { break; } while (0)
+#define xtrace_pop() do { break; } while (0)
+#else
void xtracefdsetup(int);
void xtrace_clone(int);
void xtrace_pop(void);
+#endif
#define outc(c, file) (--(file)->nleft < 0? (emptyoutbuf(file), *(file)->nextc++ = (c)) : (*(file)->nextc++ = (c)))
#define out1c(c) outc(c, out1)
Home |
Main Index |
Thread Index |
Old Index