fixup tilde expansion comments; revert a few bogus dirsep changes
cf. <Pine.BSM.4.64L.1703112129500.29506@herc.mirbsd.org>
This commit is contained in:
parent
a112d69c56
commit
bc4397e28a
8
edit.c
8
edit.c
@ -5,7 +5,7 @@
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||
* 2011, 2012, 2013, 2014, 2015, 2016
|
||||
* 2011, 2012, 2013, 2014, 2015, 2016, 2017
|
||||
* mirabilos <m@mirbsd.org>
|
||||
*
|
||||
* Provided that these terms and disclaimer and all copyright notices
|
||||
@ -28,7 +28,7 @@
|
||||
|
||||
#ifndef MKSH_NO_CMDLINE_EDITING
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.312 2016/11/11 23:48:28 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.313 2017/03/11 22:49:54 tg Exp $");
|
||||
|
||||
/*
|
||||
* in later versions we might use libtermcap for this, but since external
|
||||
@ -339,7 +339,7 @@ x_glob_hlp_tilde_and_rem_qchar(char *s, bool magic_flag)
|
||||
* and if so, discern "~foo/bar" and "~/baz" from "~blah";
|
||||
* if we have a directory part (the former), try to expand
|
||||
*/
|
||||
if (*s == '~' && (cp = mksh_sdirsep(s)) != NULL) {
|
||||
if (*s == '~' && (cp = /* not sdirsep */ strchr(s, '/')) != NULL) {
|
||||
/* ok, so split into "~foo"/"bar" or "~"/"baz" */
|
||||
*cp++ = 0;
|
||||
/* try to expand the tilde */
|
||||
@ -658,7 +658,7 @@ x_cf_glob(int *flagsp, const char *buf, int buflen, int pos, int *startp,
|
||||
}
|
||||
}
|
||||
|
||||
if (*toglob == '~' && !mksh_vdirsep(toglob)) {
|
||||
if (*toglob == '~' && /* not vdirsep */ !vstrchr(toglob, '/')) {
|
||||
/* neither for '~foo' (but '~foo/bar') */
|
||||
*flagsp |= XCF_IS_NOSPACE;
|
||||
goto dont_add_glob;
|
||||
|
17
eval.c
17
eval.c
@ -23,7 +23,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.197 2017/02/17 22:40:12 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.198 2017/03/11 22:49:55 tg Exp $");
|
||||
|
||||
/*
|
||||
* string expansion
|
||||
@ -625,13 +625,12 @@ expand(
|
||||
break;
|
||||
case '=':
|
||||
/*
|
||||
* Enabling tilde expansion
|
||||
* after :s here is
|
||||
* non-standard ksh, but is
|
||||
* consistent with rules for
|
||||
* other assignments. Not
|
||||
* sure what POSIX thinks of
|
||||
* this.
|
||||
* Tilde expansion for string
|
||||
* variables in POSIX mode is
|
||||
* governed by Austinbug 351.
|
||||
* In non-POSIX mode historic
|
||||
* ksh behaviour (enable it!)
|
||||
* us followed.
|
||||
* Not doing tilde expansion
|
||||
* for integer variables is a
|
||||
* non-POSIX thing - makes
|
||||
@ -1717,7 +1716,7 @@ maybe_expand_tilde(const char *p, XString *dsp, char **dpp, bool isassign)
|
||||
|
||||
Xinit(ts, tp, 16, ATEMP);
|
||||
/* : only for DOASNTILDE form */
|
||||
while (p[0] == CHAR && !mksh_cdirsep(p[1]) &&
|
||||
while (p[0] == CHAR && /* not cdirsep */ p[1] != '/' &&
|
||||
(!isassign || p[1] != ':')) {
|
||||
Xcheck(ts, tp);
|
||||
*tp++ = p[1];
|
||||
|
16
syn.c
16
syn.c
@ -2,7 +2,7 @@
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
||||
* 2011, 2012, 2013, 2014, 2015, 2016
|
||||
* 2011, 2012, 2013, 2014, 2015, 2016, 2017
|
||||
* mirabilos <m@mirbsd.org>
|
||||
*
|
||||
* Provided that these terms and disclaimer and all copyright notices
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.115 2016/09/01 12:59:12 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.116 2017/03/11 22:49:56 tg Exp $");
|
||||
|
||||
struct nesting_state {
|
||||
int start_token; /* token than began nesting (eg, FOR) */
|
||||
@ -937,17 +937,7 @@ compile(Source *s, bool skiputf8bom)
|
||||
return (outtree);
|
||||
}
|
||||
|
||||
/*-
|
||||
* This kludge exists to take care of sh/AT&T ksh oddity in which
|
||||
* the arguments of alias/export/readonly/typeset have no field
|
||||
* splitting, file globbing, or (normal) tilde expansion done.
|
||||
* AT&T ksh seems to do something similar to this since
|
||||
* $ touch a=a; typeset a=[ab]; echo "$a"
|
||||
* a=[ab]
|
||||
* $ x=typeset; $x a=[ab]; echo "$a"
|
||||
* a=a
|
||||
* $
|
||||
*/
|
||||
/* lexical analysis for declaration utilities */
|
||||
int
|
||||
assign_command(const char *s, bool docommand)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user