make “source” into a built-in command (keepasn, to match ksh93 and “dot”);
remove the “stop” alias and drop old Android and OS/2 hacks and auto-unalias
This commit is contained in:
		
							
								
								
									
										151
									
								
								check.t
									
									
									
									
									
								
							
							
						
						
									
										151
									
								
								check.t
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| # $MirOS: src/bin/mksh/check.t,v 1.709 2015/10/09 17:48:46 tg Exp $ | # $MirOS: src/bin/mksh/check.t,v 1.710 2015/10/09 21:36:52 tg Exp $ | ||||||
| # -*- mode: sh -*- | # -*- mode: sh -*- | ||||||
| #- | #- | ||||||
| # Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, | # Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, | ||||||
| @@ -30,7 +30,7 @@ | |||||||
| # (2013/12/02 20:39:44) http://openbsd.cs.toronto.edu/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date | # (2013/12/02 20:39:44) http://openbsd.cs.toronto.edu/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date | ||||||
|  |  | ||||||
| expected-stdout: | expected-stdout: | ||||||
| 	@(#)MIRBSD KSH R51 2015/10/05 | 	@(#)MIRBSD KSH R51 2015/10/09 | ||||||
| description: | description: | ||||||
| 	Check version of shell. | 	Check version of shell. | ||||||
| stdin: | stdin: | ||||||
| @@ -39,7 +39,7 @@ name: KSH_VERSION | |||||||
| category: shell:legacy-no | category: shell:legacy-no | ||||||
| --- | --- | ||||||
| expected-stdout: | expected-stdout: | ||||||
| 	@(#)LEGACY KSH R51 2015/10/05 | 	@(#)LEGACY KSH R51 2015/10/09 | ||||||
| description: | description: | ||||||
| 	Check version of legacy shell. | 	Check version of legacy shell. | ||||||
| stdin: | stdin: | ||||||
| @@ -7491,7 +7491,6 @@ expected-stdout: | |||||||
| name: aliases-1 | name: aliases-1 | ||||||
| description: | description: | ||||||
| 	Check if built-in shell aliases are okay | 	Check if built-in shell aliases are okay | ||||||
| category: !android,!arge,!os:os2 |  | ||||||
| stdin: | stdin: | ||||||
| 	alias | 	alias | ||||||
| 	typeset -f | 	typeset -f | ||||||
| @@ -7506,56 +7505,11 @@ expected-stdout: | |||||||
| 	nameref='\typeset -n' | 	nameref='\typeset -n' | ||||||
| 	nohup='nohup ' | 	nohup='nohup ' | ||||||
| 	r='\builtin fc -e -' | 	r='\builtin fc -e -' | ||||||
| 	source='PATH=$PATH:. \command .' |  | ||||||
| 	stop='\kill -STOP' |  | ||||||
| 	type='\builtin whence -v' |  | ||||||
| --- |  | ||||||
| name: aliases-1-hartz4 |  | ||||||
| description: |  | ||||||
| 	Check if built-in shell aliases are okay |  | ||||||
| category: android,arge |  | ||||||
| stdin: |  | ||||||
| 	alias |  | ||||||
| 	typeset -f |  | ||||||
| expected-stdout: |  | ||||||
| 	autoload='\typeset -fu' |  | ||||||
| 	functions='\typeset -f' |  | ||||||
| 	hash='\builtin alias -t' |  | ||||||
| 	history='\builtin fc -l' |  | ||||||
| 	integer='\typeset -i' |  | ||||||
| 	local='\typeset' |  | ||||||
| 	login='\exec login' |  | ||||||
| 	nameref='\typeset -n' |  | ||||||
| 	nohup='nohup ' |  | ||||||
| 	r='\builtin fc -e -' |  | ||||||
| 	source='PATH=$PATH:. \command .' |  | ||||||
| 	type='\builtin whence -v' |  | ||||||
| --- |  | ||||||
| name: aliases-1-os2 |  | ||||||
| description: |  | ||||||
| 	Check if built-in shell aliases are okay |  | ||||||
| category: os:os2 |  | ||||||
| stdin: |  | ||||||
| 	alias |  | ||||||
| 	typeset -f |  | ||||||
| expected-stdout: |  | ||||||
| 	autoload='\typeset -fu' |  | ||||||
| 	functions='\typeset -f' |  | ||||||
| 	hash='\builtin alias -t' |  | ||||||
| 	history='\builtin fc -l' |  | ||||||
| 	integer='\typeset -i' |  | ||||||
| 	local='\typeset' |  | ||||||
| 	login='\exec login' |  | ||||||
| 	nameref='\typeset -n' |  | ||||||
| 	nohup='nohup ' |  | ||||||
| 	r='\builtin fc -e -' |  | ||||||
| 	source='PATH=$PATH\;. \command .' |  | ||||||
| 	type='\builtin whence -v' | 	type='\builtin whence -v' | ||||||
| --- | --- | ||||||
| name: aliases-2b | name: aliases-2b | ||||||
| description: | description: | ||||||
| 	Check if “set -o sh” does not influence built-in aliases | 	Check if “set -o sh” does not influence built-in aliases | ||||||
| category: !android,!arge,!os:os2 |  | ||||||
| arguments: !-o!sh! | arguments: !-o!sh! | ||||||
| stdin: | stdin: | ||||||
| 	alias | 	alias | ||||||
| @@ -7571,14 +7525,11 @@ expected-stdout: | |||||||
| 	nameref='\typeset -n' | 	nameref='\typeset -n' | ||||||
| 	nohup='nohup ' | 	nohup='nohup ' | ||||||
| 	r='\builtin fc -e -' | 	r='\builtin fc -e -' | ||||||
| 	source='PATH=$PATH:. \command .' |  | ||||||
| 	stop='\kill -STOP' |  | ||||||
| 	type='\builtin whence -v' | 	type='\builtin whence -v' | ||||||
| --- | --- | ||||||
| name: aliases-3b | name: aliases-3b | ||||||
| description: | description: | ||||||
| 	Check if running as sh does not influence built-in aliases | 	Check if running as sh does not influence built-in aliases | ||||||
| category: !android,!arge,!os:os2 |  | ||||||
| stdin: | stdin: | ||||||
| 	cp "$__progname" sh | 	cp "$__progname" sh | ||||||
| 	./sh -c 'alias; typeset -f' | 	./sh -c 'alias; typeset -f' | ||||||
| @@ -7594,96 +7545,6 @@ expected-stdout: | |||||||
| 	nameref='\typeset -n' | 	nameref='\typeset -n' | ||||||
| 	nohup='nohup ' | 	nohup='nohup ' | ||||||
| 	r='\builtin fc -e -' | 	r='\builtin fc -e -' | ||||||
| 	source='PATH=$PATH:. \command .' |  | ||||||
| 	stop='\kill -STOP' |  | ||||||
| 	type='\builtin whence -v' |  | ||||||
| --- |  | ||||||
| name: aliases-2b-hartz4 |  | ||||||
| description: |  | ||||||
| 	Check if “set -o sh” does not influence built-in aliases |  | ||||||
| category: android,arge |  | ||||||
| arguments: !-o!sh! |  | ||||||
| stdin: |  | ||||||
| 	alias |  | ||||||
| 	typeset -f |  | ||||||
| expected-stdout: |  | ||||||
| 	autoload='\typeset -fu' |  | ||||||
| 	functions='\typeset -f' |  | ||||||
| 	hash='\builtin alias -t' |  | ||||||
| 	history='\builtin fc -l' |  | ||||||
| 	integer='\typeset -i' |  | ||||||
| 	local='\typeset' |  | ||||||
| 	login='\exec login' |  | ||||||
| 	nameref='\typeset -n' |  | ||||||
| 	nohup='nohup ' |  | ||||||
| 	r='\builtin fc -e -' |  | ||||||
| 	source='PATH=$PATH:. \command .' |  | ||||||
| 	type='\builtin whence -v' |  | ||||||
| --- |  | ||||||
| name: aliases-3b-hartz4 |  | ||||||
| description: |  | ||||||
| 	Check if running as sh does not influence built-in aliases |  | ||||||
| category: android,arge |  | ||||||
| stdin: |  | ||||||
| 	cp "$__progname" sh |  | ||||||
| 	./sh -c 'alias; typeset -f' |  | ||||||
| 	rm -f sh |  | ||||||
| expected-stdout: |  | ||||||
| 	autoload='\typeset -fu' |  | ||||||
| 	functions='\typeset -f' |  | ||||||
| 	hash='\builtin alias -t' |  | ||||||
| 	history='\builtin fc -l' |  | ||||||
| 	integer='\typeset -i' |  | ||||||
| 	local='\typeset' |  | ||||||
| 	login='\exec login' |  | ||||||
| 	nameref='\typeset -n' |  | ||||||
| 	nohup='nohup ' |  | ||||||
| 	r='\builtin fc -e -' |  | ||||||
| 	source='PATH=$PATH:. \command .' |  | ||||||
| 	type='\builtin whence -v' |  | ||||||
| --- |  | ||||||
| name: aliases-2b-os2 |  | ||||||
| description: |  | ||||||
| 	Check if “set -o sh” does not influence built-in aliases |  | ||||||
| category: os:os2 |  | ||||||
| arguments: !-o!sh! |  | ||||||
| stdin: |  | ||||||
| 	alias |  | ||||||
| 	typeset -f |  | ||||||
| expected-stdout: |  | ||||||
| 	autoload='\typeset -fu' |  | ||||||
| 	functions='\typeset -f' |  | ||||||
| 	hash='\builtin alias -t' |  | ||||||
| 	history='\builtin fc -l' |  | ||||||
| 	integer='\typeset -i' |  | ||||||
| 	local='\typeset' |  | ||||||
| 	login='\exec login' |  | ||||||
| 	nameref='\typeset -n' |  | ||||||
| 	nohup='nohup ' |  | ||||||
| 	r='\builtin fc -e -' |  | ||||||
| 	source='PATH=$PATH\;. \command .' |  | ||||||
| 	type='\builtin whence -v' |  | ||||||
| --- |  | ||||||
| name: aliases-3b-os2 |  | ||||||
| description: |  | ||||||
| 	Check if running as sh does not influence built-in aliases |  | ||||||
| category: os:os2 |  | ||||||
| stdin: |  | ||||||
| 	cp "$__progname" sh |  | ||||||
| 	./sh -c 'alias; typeset -f' |  | ||||||
| 	rm -f sh |  | ||||||
| expected-stdout: |  | ||||||
| 	autoload='\typeset -fu' |  | ||||||
| 	functions='\typeset -f' |  | ||||||
| 	hash='\builtin alias -t' |  | ||||||
| 	history='\builtin fc -l' |  | ||||||
| 	integer='\typeset -i' |  | ||||||
| 	local='\typeset' |  | ||||||
| 	login='\exec login' |  | ||||||
| 	nameref='\typeset -n' |  | ||||||
| 	nohup='nohup ' |  | ||||||
| 	r='\builtin fc -e -' |  | ||||||
| 	source='PATH=$PATH\;. \command .' |  | ||||||
| 	type='\builtin whence -v' | 	type='\builtin whence -v' | ||||||
| --- | --- | ||||||
| name: aliases-cmdline | name: aliases-cmdline | ||||||
| @@ -8955,7 +8816,7 @@ stdin: | |||||||
| 	7	. | 	7	. | ||||||
| --- | --- | ||||||
| name: dot-needs-argument | name: dot-needs-argument | ||||||
| description: | description: | ||||||
| 	check Debian #415167 solution: '.' without arguments should fail | 	check Debian #415167 solution: '.' without arguments should fail | ||||||
| stdin: | stdin: | ||||||
| 	"$__progname" -c . | 	"$__progname" -c . | ||||||
| @@ -9054,20 +8915,16 @@ stdin: | |||||||
| 	mk() { | 	mk() { | ||||||
| 		echo '#!'"$__progname" | 		echo '#!'"$__progname" | ||||||
| 		echo "$1 {" | 		echo "$1 {" | ||||||
| 		echo '	echo "bar='\''$0'\'\" |  | ||||||
| 		echo '}' |  | ||||||
| 		echo '	echo "bar='\''$0'\'\" | 		echo '	echo "bar='\''$0'\'\" | ||||||
| 		echo '}' | 		echo '}' | ||||||
| 		print -r -- "${2:-foo}" | 		print -r -- "${2:-foo}" | ||||||
| 	} | 	} | ||||||
| 	mk 'function foo' >f-korn | 	mk 'function foo' >f-korn | ||||||
| 	mk 'foo ()' >f-dash | 	mk 'foo ()' >f-dash | ||||||
| 	mk 'function stop ()' '\stop' >f-stop |  | ||||||
| 	mk 'function foo ()' >f-bash | 	mk 'function foo ()' >f-bash | ||||||
| 	print '#!'"$__progname"'\nprint -r -- "${0%/f-argh}"' >f-argh | 	print '#!'"$__progname"'\nprint -r -- "${0%/f-argh}"' >f-argh | ||||||
| 	chmod +x f-* | 	chmod +x f-* | ||||||
| 	u=$(./f-argh) | 	u=$(./f-argh) | ||||||
| 	x="dash: $(./f-dash)"; echo "${x/@("$u")/.}" |  | ||||||
| 	x="korn: $(./f-korn)"; echo "${x/@("$u")/.}" | 	x="korn: $(./f-korn)"; echo "${x/@("$u")/.}" | ||||||
| 	x="dash: $(./f-dash)"; echo "${x/@("$u")/.}" | 	x="dash: $(./f-dash)"; echo "${x/@("$u")/.}" | ||||||
| 	x="bash: $(./f-bash)"; echo "${x/@("$u")/.}" | 	x="bash: $(./f-bash)"; echo "${x/@("$u")/.}" | ||||||
|   | |||||||
| @@ -1,9 +1,9 @@ | |||||||
| # $Id$ | # $Id$ | ||||||
| # $MirOS: src/bin/mksh/dot.mkshrc,v 1.101 2015/07/18 23:03:24 tg Exp $ | # $MirOS: src/bin/mksh/dot.mkshrc,v 1.102 2015/10/09 21:36:54 tg Exp $ | ||||||
| #- | #- | ||||||
| # Copyright (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, | # Copyright (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, | ||||||
| #		2011, 2012, 2013, 2014, 2015 | #		2011, 2012, 2013, 2014, 2015 | ||||||
| #	mirabilos <tg@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 | ||||||
| # are retained or reproduced in an accompanying document, permission | # are retained or reproduced in an accompanying document, permission | ||||||
| @@ -410,9 +410,6 @@ function enable { | |||||||
| 	i_alias[nalias]=nameref; b_alias[nalias++]='\typeset -n' | 	i_alias[nalias]=nameref; b_alias[nalias++]='\typeset -n' | ||||||
| 	i_alias[nalias]=nohup; b_alias[nalias++]='nohup ' | 	i_alias[nalias]=nohup; b_alias[nalias++]='nohup ' | ||||||
| 	i_alias[nalias]=r; b_alias[nalias++]='\builtin fc -e -' | 	i_alias[nalias]=r; b_alias[nalias++]='\builtin fc -e -' | ||||||
| 	#XXX OS/2 |  | ||||||
| 	i_alias[nalias]=source; b_alias[nalias++]='PATH=$PATH:. \command .' |  | ||||||
| 	i_alias[nalias]=stop; b_alias[nalias++]='\kill -STOP' |  | ||||||
| 	i_alias[nalias]=type; b_alias[nalias++]='\builtin whence -v' | 	i_alias[nalias]=type; b_alias[nalias++]='\builtin whence -v' | ||||||
|  |  | ||||||
| 	# accumulate mksh built-in utilities, in definition order, even ifndef | 	# accumulate mksh built-in utilities, in definition order, even ifndef | ||||||
| @@ -449,6 +446,7 @@ function enable { | |||||||
| 	i_func[nfunc++]=return | 	i_func[nfunc++]=return | ||||||
| 	i_func[nfunc++]=set | 	i_func[nfunc++]=set | ||||||
| 	i_func[nfunc++]=shift | 	i_func[nfunc++]=shift | ||||||
|  | 	i_func[nfunc++]=source | ||||||
| 	i_func[nfunc++]=suspend | 	i_func[nfunc++]=suspend | ||||||
| 	i_func[nfunc++]=test | 	i_func[nfunc++]=test | ||||||
| 	i_func[nfunc++]=times | 	i_func[nfunc++]=times | ||||||
| @@ -468,6 +466,7 @@ function enable { | |||||||
| 	i_func[nfunc++]=printf | 	i_func[nfunc++]=printf | ||||||
| 	i_func[nfunc++]=sleep | 	i_func[nfunc++]=sleep | ||||||
| 	i_func[nfunc++]=domainname | 	i_func[nfunc++]=domainname | ||||||
|  | 	i_func[nfunc++]=extproc | ||||||
|  |  | ||||||
| 	# accumulate aliases from dot.mkshrc, in definition order | 	# accumulate aliases from dot.mkshrc, in definition order | ||||||
| 	i_alias[nalias]=l; b_alias[nalias++]='ls -F' | 	i_alias[nalias]=l; b_alias[nalias++]='ls -F' | ||||||
|   | |||||||
							
								
								
									
										13
									
								
								exec.c
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								exec.c
									
									
									
									
									
								
							| @@ -23,7 +23,7 @@ | |||||||
|  |  | ||||||
| #include "sh.h" | #include "sh.h" | ||||||
|  |  | ||||||
| __RCSID("$MirOS: src/bin/mksh/exec.c,v 1.167 2015/10/09 19:29:48 tg Exp $"); | __RCSID("$MirOS: src/bin/mksh/exec.c,v 1.168 2015/10/09 21:36:55 tg Exp $"); | ||||||
|  |  | ||||||
| #ifndef MKSH_DEFAULT_EXECSHELL | #ifndef MKSH_DEFAULT_EXECSHELL | ||||||
| #define MKSH_DEFAULT_EXECSHELL	MKSH_UNIXROOT "/bin/sh" | #define MKSH_DEFAULT_EXECSHELL	MKSH_UNIXROOT "/bin/sh" | ||||||
| @@ -39,7 +39,6 @@ static const char *do_selectargs(const char **, bool); | |||||||
| static Test_op dbteste_isa(Test_env *, Test_meta); | static Test_op dbteste_isa(Test_env *, Test_meta); | ||||||
| static const char *dbteste_getopnd(Test_env *, Test_op, bool); | static const char *dbteste_getopnd(Test_env *, Test_op, bool); | ||||||
| static void dbteste_error(Test_env *, int, const char *); | static void dbteste_error(Test_env *, int, const char *); | ||||||
| static int search_access(const char *, int); |  | ||||||
| /* XXX: horrible kludge to fit within the framework */ | /* XXX: horrible kludge to fit within the framework */ | ||||||
| static void plain_fmt_entry(char *, size_t, unsigned int, const void *); | static void plain_fmt_entry(char *, size_t, unsigned int, const void *); | ||||||
| static void select_fmt_entry(char *, size_t, unsigned int, const void *); | static void select_fmt_entry(char *, size_t, unsigned int, const void *); | ||||||
| @@ -1065,14 +1064,6 @@ define(const char *name, struct op *t) | |||||||
|  |  | ||||||
| 	nhash = hash(name); | 	nhash = hash(name); | ||||||
|  |  | ||||||
| #ifdef MKSH_LEGACY_MODE |  | ||||||
| 	if (t != NULL && !tobool(t->u.ksh_func)) { |  | ||||||
| 		/* drop same-name aliases for POSIX functions */ |  | ||||||
| 		if ((tp = ktsearch(&aliases, name, nhash))) |  | ||||||
| 			ktdelete(tp); |  | ||||||
| 	} |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| 	while (/* CONSTCOND */ 1) { | 	while (/* CONSTCOND */ 1) { | ||||||
| 		tp = findfunc(name, nhash, true); | 		tp = findfunc(name, nhash, true); | ||||||
|  |  | ||||||
| @@ -1257,7 +1248,7 @@ flushcom(bool all) | |||||||
| } | } | ||||||
|  |  | ||||||
| /* check if path is something we want to find */ | /* check if path is something we want to find */ | ||||||
| static int | int | ||||||
| search_access(const char *fn, int mode) | search_access(const char *fn, int mode) | ||||||
| { | { | ||||||
| 	struct stat sb; | 	struct stat sb; | ||||||
|   | |||||||
							
								
								
									
										9
									
								
								funcs.c
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								funcs.c
									
									
									
									
									
								
							| @@ -38,7 +38,7 @@ | |||||||
| #endif | #endif | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| __RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.285 2015/10/09 17:48:50 tg Exp $"); | __RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.286 2015/10/09 21:36:55 tg Exp $"); | ||||||
|  |  | ||||||
| #if HAVE_KILLPG | #if HAVE_KILLPG | ||||||
| /* | /* | ||||||
| @@ -127,6 +127,7 @@ const struct builtin mkshbuiltins[] = { | |||||||
| 	{"*=return", c_exitreturn}, | 	{"*=return", c_exitreturn}, | ||||||
| 	{Tsgset, c_set}, | 	{Tsgset, c_set}, | ||||||
| 	{"*=shift", c_shift}, | 	{"*=shift", c_shift}, | ||||||
|  | 	{"=source", c_dot}, | ||||||
| #if !defined(MKSH_UNEMPLOYED) && HAVE_GETSID | #if !defined(MKSH_UNEMPLOYED) && HAVE_GETSID | ||||||
| 	{"suspend", c_suspend}, | 	{"suspend", c_suspend}, | ||||||
| #endif | #endif | ||||||
| @@ -1786,7 +1787,11 @@ c_dot(const char **wp) | |||||||
| 		bi_errorf("missing argument"); | 		bi_errorf("missing argument"); | ||||||
| 		return (1); | 		return (1); | ||||||
| 	} | 	} | ||||||
| 	if ((file = search_path(cp, path, R_OK, &errcode)) == NULL) { | 	file = search_path(cp, path, R_OK, &errcode); | ||||||
|  | 	if (!file && errcode == ENOENT && wp[0][0] == 's' && | ||||||
|  | 	    search_access(cp, R_OK) == 0) | ||||||
|  | 		file = cp; | ||||||
|  | 	if (!file) { | ||||||
| 		bi_errorf("%s: %s", cp, cstrerror(errcode)); | 		bi_errorf("%s: %s", cp, cstrerror(errcode)); | ||||||
| 		return (1); | 		return (1); | ||||||
| 	} | 	} | ||||||
|   | |||||||
							
								
								
									
										14
									
								
								lksh.1
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								lksh.1
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| .\" $MirOS: src/bin/mksh/lksh.1,v 1.14 2015/10/09 20:33:49 tg Exp $ | .\" $MirOS: src/bin/mksh/lksh.1,v 1.15 2015/10/09 21:36:56 tg Exp $ | ||||||
| .\"- | .\"- | ||||||
| .\" Copyright (c) 2008, 2009, 2010, 2012, 2013, 2015 | .\" Copyright (c) 2008, 2009, 2010, 2012, 2013, 2015 | ||||||
| .\"	mirabilos <m@mirbsd.org> | .\"	mirabilos <m@mirbsd.org> | ||||||
| @@ -289,18 +289,6 @@ mode and | |||||||
| .Nm lksh | .Nm lksh | ||||||
| do not keep file descriptors \*(Gt 2 private from sub-processes. | do not keep file descriptors \*(Gt 2 private from sub-processes. | ||||||
| .It | .It | ||||||
| .\"XXX TODO: move to FSH? fix upstreams? both ugh. |  | ||||||
| .Nm lksh |  | ||||||
| undefines an alias when a |  | ||||||
| .Tn POSIX |  | ||||||
| function with the same name is defined, |  | ||||||
| to make that function immediately callable. |  | ||||||
| In |  | ||||||
| .Nm mksh , |  | ||||||
| aliases have precedence; the name must be quoted or |  | ||||||
| .Ic unalias Ns ed |  | ||||||
| to access it. |  | ||||||
| .It |  | ||||||
| Functions defined with the | Functions defined with the | ||||||
| .Ic function | .Ic function | ||||||
| reserved word share the shell options | reserved word share the shell options | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								main.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								main.c
									
									
									
									
									
								
							| @@ -34,7 +34,7 @@ | |||||||
| #include <locale.h> | #include <locale.h> | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| __RCSID("$MirOS: src/bin/mksh/main.c,v 1.305 2015/10/09 17:48:51 tg Exp $"); | __RCSID("$MirOS: src/bin/mksh/main.c,v 1.306 2015/10/09 21:36:57 tg Exp $"); | ||||||
|  |  | ||||||
| extern char **environ; | extern char **environ; | ||||||
|  |  | ||||||
| @@ -71,18 +71,12 @@ static const char *initcoms[] = { | |||||||
| 	/* not "alias -t --": hash -r needs to work */ | 	/* not "alias -t --": hash -r needs to work */ | ||||||
| 	"hash=\\builtin alias -t", | 	"hash=\\builtin alias -t", | ||||||
| 	"type=\\builtin whence -v", | 	"type=\\builtin whence -v", | ||||||
| #if !defined(ANDROID) && !defined(MKSH_UNEMPLOYED) |  | ||||||
| 	/* not in Android for political reasons */ |  | ||||||
| 	/* not in ARGE mksh due to no job control */ |  | ||||||
| 	"stop=\\kill -STOP", |  | ||||||
| #endif |  | ||||||
| 	"autoload=\\typeset -fu", | 	"autoload=\\typeset -fu", | ||||||
| 	"functions=\\typeset -f", | 	"functions=\\typeset -f", | ||||||
| 	"history=\\builtin fc -l", | 	"history=\\builtin fc -l", | ||||||
| 	"nameref=\\typeset -n", | 	"nameref=\\typeset -n", | ||||||
| 	"nohup=nohup ", | 	"nohup=nohup ", | ||||||
| 	"r=\\builtin fc -e -", | 	"r=\\builtin fc -e -", | ||||||
| 	"source=PATH=$PATH" MKSH_PATHSEPE ". \\command .", |  | ||||||
| 	"login=\\exec login", | 	"login=\\exec login", | ||||||
| 	NULL, | 	NULL, | ||||||
| 	 /* this is what AT&T ksh seems to track, with the addition of emacs */ | 	 /* this is what AT&T ksh seems to track, with the addition of emacs */ | ||||||
| @@ -255,7 +249,7 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp) | |||||||
|  |  | ||||||
| 	/* define built-in commands and see if we were called as one */ | 	/* define built-in commands and see if we were called as one */ | ||||||
| 	ktinit(APERM, &builtins, | 	ktinit(APERM, &builtins, | ||||||
| 	    /* currently up to 51 builtins: 75% of 128 = 2^7 */ | 	    /* currently up to 54 builtins: 75% of 128 = 2^7 */ | ||||||
| 	    7); | 	    7); | ||||||
| 	for (i = 0; mkshbuiltins[i].name != NULL; i++) | 	for (i = 0; mkshbuiltins[i].name != NULL; i++) | ||||||
| 		if (!strcmp(ccp, builtin(mkshbuiltins[i].name, | 		if (!strcmp(ccp, builtin(mkshbuiltins[i].name, | ||||||
|   | |||||||
							
								
								
									
										33
									
								
								mksh.1
									
									
									
									
									
								
							
							
						
						
									
										33
									
								
								mksh.1
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| .\" $MirOS: src/bin/mksh/mksh.1,v 1.381 2015/10/09 20:43:11 tg Exp $ | .\" $MirOS: src/bin/mksh/mksh.1,v 1.382 2015/10/09 21:36:57 tg Exp $ | ||||||
| .\" $OpenBSD: ksh.1,v 1.160 2015/07/04 13:27:04 feinerer Exp $ | .\" $OpenBSD: ksh.1,v 1.160 2015/07/04 13:27:04 feinerer Exp $ | ||||||
| .\"- | .\"- | ||||||
| .\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, | .\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, | ||||||
| @@ -1130,8 +1130,6 @@ login=\*(aq\eexec login\*(aq | |||||||
| nameref=\*(aq\etypeset \-n\*(aq | nameref=\*(aq\etypeset \-n\*(aq | ||||||
| nohup=\*(aqnohup \*(aq | nohup=\*(aqnohup \*(aq | ||||||
| r=\*(aq\ebuiltin fc \-e \-\*(aq | r=\*(aq\ebuiltin fc \-e \-\*(aq | ||||||
| source=\*(aqPATH=$PATH:. \ecommand .\*(aq |  | ||||||
| stop=\*(aq\ekill \-STOP\*(aq |  | ||||||
| type=\*(aq\ebuiltin whence \-v\*(aq | type=\*(aq\ebuiltin whence \-v\*(aq | ||||||
| .Ed | .Ed | ||||||
| .Pp | .Pp | ||||||
| @@ -2942,18 +2940,18 @@ Additional | |||||||
| .Nm | .Nm | ||||||
| commands keeping assignments: | commands keeping assignments: | ||||||
| .Pp | .Pp | ||||||
| .Ic builtin , global , typeset , wait | .Ic builtin , global , source , typeset , | ||||||
|  | .Ic wait | ||||||
| .Pp | .Pp | ||||||
| Builtins that are not special: | Builtins that are not special: | ||||||
| .Pp | .Pp | ||||||
| .Ic [ , alias , bg , bind , | .Ic [ , alias , bg , bind , | ||||||
| .Ic cat , cd , command , echo , | .Ic cat , cd , command , echo , | ||||||
| .Ic false , fc , fg , getopts , | .Ic false , fc , fg , getopts , | ||||||
| .Ic jobs , kill , let , mknod , | .Ic jobs , kill , let , print , | ||||||
| .Ic print , pwd , read , realpath , | .Ic pwd , read , realpath , rename , | ||||||
| .Ic rename , sleep , suspend , test , | .Ic sleep , suspend , test , true , | ||||||
| .Ic true , ulimit , umask , unalias , | .Ic ulimit , umask , unalias , whence | ||||||
| .Ic whence |  | ||||||
| .Pp | .Pp | ||||||
| Once the type of command has been determined, any command-line parameter | Once the type of command has been determined, any command-line parameter | ||||||
| assignments are performed and exported for the duration of the command. | assignments are performed and exported for the duration of the command. | ||||||
| @@ -3673,10 +3671,6 @@ option), | |||||||
| and | and | ||||||
| .Ar minor | .Ar minor | ||||||
| (minor device number). | (minor device number). | ||||||
| .Pp |  | ||||||
| See |  | ||||||
| .Xr mknod 8 |  | ||||||
| for further information. |  | ||||||
| This is not normally part of | This is not normally part of | ||||||
| .Nm mksh ; | .Nm mksh ; | ||||||
| however, distributors may have added this as builtin as a speed hack. | however, distributors may have added this as builtin as a speed hack. | ||||||
| @@ -4324,16 +4318,9 @@ Signal delivery may continue execution earlier. | |||||||
| Like | Like | ||||||
| .Ic \&. Po Do dot Dc Pc , | .Ic \&. Po Do dot Dc Pc , | ||||||
| except that the current working directory is appended to the | except that the current working directory is appended to the | ||||||
| .Ev PATH | search path (GNU | ||||||
| in GNU |  | ||||||
| .Nm bash | .Nm bash | ||||||
| and | extension). | ||||||
| .Nm mksh . |  | ||||||
| In |  | ||||||
| .Nm ksh93 |  | ||||||
| and |  | ||||||
| .Nm mksh , |  | ||||||
| this is implemented as a shell alias instead of a builtin. |  | ||||||
| .Pp | .Pp | ||||||
| .It Ic suspend | .It Ic suspend | ||||||
| Stops the shell as if it had received the suspend character from | Stops the shell as if it had received the suspend character from | ||||||
| @@ -6578,7 +6565,7 @@ for the in-memory portion of the history is slow, should use | |||||||
| .Xr memmove 3 . | .Xr memmove 3 . | ||||||
| .Pp | .Pp | ||||||
| This document attempts to describe | This document attempts to describe | ||||||
| .Nm mksh\ R51 | .Nm mksh\ R51 Ns -CVS | ||||||
| and up, | and up, | ||||||
| .\" with vendor patches from insert-your-name-here, | .\" with vendor patches from insert-your-name-here, | ||||||
| compiled without any options impacting functionality, such as | compiled without any options impacting functionality, such as | ||||||
|   | |||||||
							
								
								
									
										13
									
								
								sh.h
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								sh.h
									
									
									
									
									
								
							| @@ -172,9 +172,9 @@ | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifdef EXTERN | #ifdef EXTERN | ||||||
| __RCSID("$MirOS: src/bin/mksh/sh.h,v 1.748 2015/10/09 19:29:49 tg Exp $"); | __RCSID("$MirOS: src/bin/mksh/sh.h,v 1.749 2015/10/09 21:36:59 tg Exp $"); | ||||||
| #endif | #endif | ||||||
| #define MKSH_VERSION "R51 2015/10/05" | #define MKSH_VERSION "R51 2015/10/09" | ||||||
|  |  | ||||||
| /* arithmetic types: C implementation */ | /* arithmetic types: C implementation */ | ||||||
| #if !HAVE_CAN_INTTYPES | #if !HAVE_CAN_INTTYPES | ||||||
| @@ -387,12 +387,10 @@ struct rusage { | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifdef __OS2__ | #ifdef __OS2__ | ||||||
| #define MKSH_PATHSEPE	"\\;" |  | ||||||
| #define MKSH_PATHSEPS	";" | #define MKSH_PATHSEPS	";" | ||||||
| #define MKSH_PATHSEPC	';' | #define MKSH_PATHSEPC	';' | ||||||
| #define MKSH_UNIXROOT	"/@unixroot" | #define MKSH_UNIXROOT	"/@unixroot" | ||||||
| #else | #else | ||||||
| #define MKSH_PATHSEPE	":" |  | ||||||
| #define MKSH_PATHSEPS	":" | #define MKSH_PATHSEPS	":" | ||||||
| #define MKSH_PATHSEPC	':' | #define MKSH_PATHSEPC	':' | ||||||
| #define MKSH_UNIXROOT	"" | #define MKSH_UNIXROOT	"" | ||||||
| @@ -1047,7 +1045,7 @@ EXTERN sigset_t		sm_default, sm_sigchld; | |||||||
|  |  | ||||||
| /* name of called builtin function (used by error functions) */ | /* name of called builtin function (used by error functions) */ | ||||||
| EXTERN const char *builtin_argv0; | EXTERN const char *builtin_argv0; | ||||||
| /* is called builtin SPEC_BI? */ | /* is called builtin SPEC_BI? (also KEEPASN, odd use though) */ | ||||||
| EXTERN bool builtin_spec; | EXTERN bool builtin_spec; | ||||||
|  |  | ||||||
| /* current working directory */ | /* current working directory */ | ||||||
| @@ -1072,12 +1070,8 @@ EXTERN mksh_ari_t x_lins E_INIT(24);	/* tty lines */ | |||||||
| /* Determine the location of the system (common) profile */ | /* Determine the location of the system (common) profile */ | ||||||
|  |  | ||||||
| #ifndef MKSH_DEFAULT_PROFILEDIR | #ifndef MKSH_DEFAULT_PROFILEDIR | ||||||
| #if defined(ANDROID) |  | ||||||
| #define MKSH_DEFAULT_PROFILEDIR	"/system/etc" |  | ||||||
| #else |  | ||||||
| #define MKSH_DEFAULT_PROFILEDIR	"/etc" | #define MKSH_DEFAULT_PROFILEDIR	"/etc" | ||||||
| #endif | #endif | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #define MKSH_SYSTEM_PROFILE	MKSH_DEFAULT_PROFILEDIR "/profile" | #define MKSH_SYSTEM_PROFILE	MKSH_DEFAULT_PROFILEDIR "/profile" | ||||||
| #define MKSH_SUID_PROFILE	MKSH_DEFAULT_PROFILEDIR "/suid_profile" | #define MKSH_SUID_PROFILE	MKSH_DEFAULT_PROFILEDIR "/suid_profile" | ||||||
| @@ -1719,6 +1713,7 @@ int define(const char *, struct op *); | |||||||
| const char *builtin(const char *, int (*)(const char **)); | const char *builtin(const char *, int (*)(const char **)); | ||||||
| struct tbl *findcom(const char *, int); | struct tbl *findcom(const char *, int); | ||||||
| void flushcom(bool); | void flushcom(bool); | ||||||
|  | int search_access(const char *, int); | ||||||
| const char *search_path(const char *, const char *, int, int *); | const char *search_path(const char *, const char *, int, int *); | ||||||
| void pr_menu(const char * const *); | void pr_menu(const char * const *); | ||||||
| void pr_list(char * const *); | void pr_list(char * const *); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user