From 9a36d1f01970b41806cf76ca36d966fec1c6aefc Mon Sep 17 00:00:00 2001 From: anton Date: Sun, 14 Jan 2018 16:04:21 +0000 Subject: [PATCH] unifdef BRACE_EXPAND; ok jca@ --- bin/ksh/config.h | 5 +---- bin/ksh/emacs.c | 4 ++-- bin/ksh/eval.c | 15 ++------------- bin/ksh/main.c | 4 +--- bin/ksh/misc.c | 9 ++------- bin/ksh/sh.h | 4 +--- 6 files changed, 9 insertions(+), 32 deletions(-) diff --git a/bin/ksh/config.h b/bin/ksh/config.h index 2165a69ef0c..9c9e35f3ac5 100644 --- a/bin/ksh/config.h +++ b/bin/ksh/config.h @@ -1,4 +1,4 @@ -/* $OpenBSD: config.h,v 1.17 2018/01/05 15:44:31 jca Exp $ */ +/* $OpenBSD: config.h,v 1.18 2018/01/14 16:04:21 anton Exp $ */ /* config.h. NOT generated automatically. */ @@ -11,9 +11,6 @@ #ifndef CONFIG_H #define CONFIG_H -/* Include brace-expansion? */ -#define BRACE_EXPAND 1 - /* Include any history? */ #define HISTORY 1 diff --git a/bin/ksh/emacs.c b/bin/ksh/emacs.c index 56a70b74700..4c591e27b42 100644 --- a/bin/ksh/emacs.c +++ b/bin/ksh/emacs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: emacs.c,v 1.82 2018/01/08 13:01:31 millert Exp $ */ +/* $OpenBSD: emacs.c,v 1.83 2018/01/14 16:04:21 anton Exp $ */ /* * Emacs-like command line editing and history @@ -2132,4 +2132,4 @@ x_lastcp(void) return (xlp); } -#endif /* EDIT */ +#endif /* EMACS */ diff --git a/bin/ksh/eval.c b/bin/ksh/eval.c index d47e057d7f4..7bc9b8bd721 100644 --- a/bin/ksh/eval.c +++ b/bin/ksh/eval.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eval.c,v 1.57 2018/01/06 16:28:58 millert Exp $ */ +/* $OpenBSD: eval.c,v 1.58 2018/01/14 16:04:21 anton Exp $ */ /* * Expansion - quoting, separation, substitution, globbing @@ -56,9 +56,7 @@ static void globit(XString *, char **, char *, XPtrV *, int); static char *maybe_expand_tilde(char *, XString *, char **, int); static char *tilde(char *); static char *homedir(char *); -#ifdef BRACE_EXPAND static void alt_expand(XPtrV *, char *, char *, char *, int); -#endif /* compile and expand word */ char * @@ -180,10 +178,8 @@ expand(char *cp, /* input word */ f &= ~DOGLOB; if (Flag(FMARKDIRS)) f |= DOMARKDIRS; -#ifdef BRACE_EXPAND if (Flag(FBRACEEXPAND) && (f & DOGLOB)) f |= DOBRACE_; -#endif /* BRACE_EXPAND */ Xinit(ds, dp, 128, ATEMP); /* init dest. string */ type = XBASE; @@ -563,15 +559,12 @@ expand(char *cp, /* input word */ *dp++ = '\0'; p = Xclose(ds, dp); -#ifdef BRACE_EXPAND if (fdo & DOBRACE_) /* also does globbing */ alt_expand(wp, p, p, p + Xlength(ds, (dp - 1)), fdo | (f & DOMARKDIRS)); - else -#endif /* BRACE_EXPAND */ - if (fdo & DOGLOB) + else if (fdo & DOGLOB) glob(p, wp, f & DOMARKDIRS); else if ((f & DOPAT) || !(fdo & DOMAGIC_)) XPput(*wp, p); @@ -628,7 +621,6 @@ expand(char *cp, /* input word */ *dp++ = MAGIC; } break; -#ifdef BRACE_EXPAND case OBRACE: case ',': case CBRACE: @@ -638,7 +630,6 @@ expand(char *cp, /* input word */ *dp++ = MAGIC; } break; -#endif /* BRACE_EXPAND */ case '=': /* Note first unquoted = for ~ */ if (!(f & DOTEMP_) && !saw_eq) { @@ -1221,7 +1212,6 @@ homedir(char *name) return ap->val.s; } -#ifdef BRACE_EXPAND static void alt_expand(XPtrV *wp, char *start, char *exp_start, char *end, int fdo) { @@ -1296,4 +1286,3 @@ alt_expand(XPtrV *wp, char *start, char *exp_start, char *end, int fdo) } return; } -#endif /* BRACE_EXPAND */ diff --git a/bin/ksh/main.c b/bin/ksh/main.c index 66c2d9e5b68..044099605fe 100644 --- a/bin/ksh/main.c +++ b/bin/ksh/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.86 2018/01/05 15:44:31 jca Exp $ */ +/* $OpenBSD: main.c,v 1.87 2018/01/14 16:04:21 anton Exp $ */ /* * startup, main loop, environments and error handling @@ -226,9 +226,7 @@ main(int argc, char *argv[]) * brace expansion, so set this before setting up FPOSIX * (change_flag() clears FBRACEEXPAND when FPOSIX is set). */ -#ifdef BRACE_EXPAND Flag(FBRACEEXPAND) = 1; -#endif /* BRACE_EXPAND */ /* set posix flag just before environment so that it will have * exactly the same effect as the POSIXLY_CORRECT environment diff --git a/bin/ksh/misc.c b/bin/ksh/misc.c index f9f41ba23bc..37124c3f022 100644 --- a/bin/ksh/misc.c +++ b/bin/ksh/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.65 2018/01/06 16:28:58 millert Exp $ */ +/* $OpenBSD: misc.c,v 1.66 2018/01/14 16:04:21 anton Exp $ */ /* * Miscellaneous functions @@ -121,9 +121,7 @@ const struct option sh_options[] = { * entries MUST match the order of sh_flag F* enumerations in sh.h. */ { "allexport", 'a', OF_ANY }, -#ifdef BRACE_EXPAND { "braceexpand", 0, OF_ANY }, /* non-standard */ -#endif { "bgnice", 0, OF_ANY }, { NULL, 'c', OF_CMDLINE }, { "csh-history", 0, OF_ANY }, /* non-standard */ @@ -301,10 +299,7 @@ change_flag(enum sh_flag f, setgroups(1, &gid); setresuid(ksheuid, ksheuid, ksheuid); } else if (f == FPOSIX && newval) { -#ifdef BRACE_EXPAND - Flag(FBRACEEXPAND) = 0 -#endif /* BRACE_EXPAND */ - ; + Flag(FBRACEEXPAND) = 0; } /* Changing interactive flag? */ if (f == FTALKING) { diff --git a/bin/ksh/sh.h b/bin/ksh/sh.h index e573b847a5d..d2fab9ebb14 100644 --- a/bin/ksh/sh.h +++ b/bin/ksh/sh.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sh.h,v 1.68 2018/01/06 16:28:58 millert Exp $ */ +/* $OpenBSD: sh.h,v 1.69 2018/01/14 16:04:21 anton Exp $ */ /* * Public Domain Bourne/Korn shell @@ -132,9 +132,7 @@ extern const struct option sh_options[]; */ enum sh_flag { FEXPORT = 0, /* -a: export all */ -#ifdef BRACE_EXPAND FBRACEEXPAND, /* enable {} globbing */ -#endif FBGNICE, /* bgnice */ FCOMMAND, /* -c: (invocation) execute specified command */ FCSHHISTORY, /* csh-style history enabled */ -- 2.20.1