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:
8
edit.c
8
edit.c
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
* 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>
|
* mirabilos <m@mirbsd.org>
|
||||||
*
|
*
|
||||||
* Provided that these terms and disclaimer and all copyright notices
|
* Provided that these terms and disclaimer and all copyright notices
|
||||||
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#ifndef MKSH_NO_CMDLINE_EDITING
|
#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
|
* 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";
|
* and if so, discern "~foo/bar" and "~/baz" from "~blah";
|
||||||
* if we have a directory part (the former), try to expand
|
* 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" */
|
/* ok, so split into "~foo"/"bar" or "~"/"baz" */
|
||||||
*cp++ = 0;
|
*cp++ = 0;
|
||||||
/* try to expand the tilde */
|
/* 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') */
|
/* neither for '~foo' (but '~foo/bar') */
|
||||||
*flagsp |= XCF_IS_NOSPACE;
|
*flagsp |= XCF_IS_NOSPACE;
|
||||||
goto dont_add_glob;
|
goto dont_add_glob;
|
||||||
|
17
eval.c
17
eval.c
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#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
|
* string expansion
|
||||||
@ -625,13 +625,12 @@ expand(
|
|||||||
break;
|
break;
|
||||||
case '=':
|
case '=':
|
||||||
/*
|
/*
|
||||||
* Enabling tilde expansion
|
* Tilde expansion for string
|
||||||
* after :s here is
|
* variables in POSIX mode is
|
||||||
* non-standard ksh, but is
|
* governed by Austinbug 351.
|
||||||
* consistent with rules for
|
* In non-POSIX mode historic
|
||||||
* other assignments. Not
|
* ksh behaviour (enable it!)
|
||||||
* sure what POSIX thinks of
|
* us followed.
|
||||||
* this.
|
|
||||||
* Not doing tilde expansion
|
* Not doing tilde expansion
|
||||||
* for integer variables is a
|
* for integer variables is a
|
||||||
* non-POSIX thing - makes
|
* 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);
|
Xinit(ts, tp, 16, ATEMP);
|
||||||
/* : only for DOASNTILDE form */
|
/* : only for DOASNTILDE form */
|
||||||
while (p[0] == CHAR && !mksh_cdirsep(p[1]) &&
|
while (p[0] == CHAR && /* not cdirsep */ p[1] != '/' &&
|
||||||
(!isassign || p[1] != ':')) {
|
(!isassign || p[1] != ':')) {
|
||||||
Xcheck(ts, tp);
|
Xcheck(ts, tp);
|
||||||
*tp++ = p[1];
|
*tp++ = p[1];
|
||||||
|
16
syn.c
16
syn.c
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
* 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>
|
* mirabilos <m@mirbsd.org>
|
||||||
*
|
*
|
||||||
* Provided that these terms and disclaimer and all copyright notices
|
* Provided that these terms and disclaimer and all copyright notices
|
||||||
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#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 {
|
struct nesting_state {
|
||||||
int start_token; /* token than began nesting (eg, FOR) */
|
int start_token; /* token than began nesting (eg, FOR) */
|
||||||
@ -937,17 +937,7 @@ compile(Source *s, bool skiputf8bom)
|
|||||||
return (outtree);
|
return (outtree);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-
|
/* lexical analysis for declaration utilities */
|
||||||
* 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
|
|
||||||
* $
|
|
||||||
*/
|
|
||||||
int
|
int
|
||||||
assign_command(const char *s, bool docommand)
|
assign_command(const char *s, bool docommand)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user