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).
This commit is contained in:
parent
17bc61630c
commit
ae40879b6d
@ -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 @@ qflag quietprofile q # disable -v/-x in startup files
|
||||
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
|
||||
|
@ -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 @@ set_opt_val(size_t i, int val)
|
||||
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 @@ minus_o(char *name, int val)
|
||||
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 @@ setoption(int flag, int val)
|
||||
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);
|
||||
|
@ -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 @@ __RCSID("$NetBSD: output.c,v 1.39 2017/11/19 03:23:01 kre Exp $");
|
||||
#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 @@ out2str(const char *p)
|
||||
outstr(p, out2);
|
||||
}
|
||||
|
||||
#ifndef SMALL
|
||||
void
|
||||
outxstr(const char *p)
|
||||
{
|
||||
outstr(p, outx);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
@ -158,11 +168,13 @@ out2shstr(const char *p)
|
||||
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 @@ xwrite(int fd, char *buf, int nbytes)
|
||||
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 @@ xtrace_pop(void)
|
||||
CTRACE(DBG_OUTPUT, ("-> fd=%d buf=%p nleft=%d flags=%x\n",
|
||||
outx->fd, outx->buf, outx->nleft, outx->flags));
|
||||
}
|
||||
#endif /* SMALL */
|
||||
|
@ -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 @@ struct output {
|
||||
char *buf;
|
||||
short fd;
|
||||
short flags;
|
||||
#ifndef SMALL
|
||||
struct output *chain;
|
||||
#endif
|
||||
};
|
||||
|
||||
/* flags for ->flags */
|
||||
@ -57,15 +59,24 @@ extern struct output errout;
|
||||
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 debugprintf(const char *, ...) __printflike(1, 2);
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user