Implement the “source” command, as requested by some and agreed bsiegert@
In contrast to AT&T ksh93, its semantics are like GNU bash in that it ap- pends the current working directory to the search path; it is implemented as a shell alias instead of enhancing funcs.c:shbuiltins[] like in ksh93.
This commit is contained in:
parent
7381c6c274
commit
f684b0ceb1
5
check.t
5
check.t
@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/check.t,v 1.133 2007/08/12 13:42:20 tg Exp $
|
# $MirOS: src/bin/mksh/check.t,v 1.134 2007/08/13 19:39:19 tg Exp $
|
||||||
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
|
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
|
||||||
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
|
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
|
||||||
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
|
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
|
||||||
@ -7,7 +7,7 @@
|
|||||||
# http://www.research.att.com/~gsf/public/ifs.sh
|
# http://www.research.att.com/~gsf/public/ifs.sh
|
||||||
|
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)MIRBSD KSH R30 2007/08/12
|
@(#)MIRBSD KSH R30 2007/08/13
|
||||||
description:
|
description:
|
||||||
Check version of shell.
|
Check version of shell.
|
||||||
category: pdksh
|
category: pdksh
|
||||||
@ -4002,6 +4002,7 @@ expected-stdout:
|
|||||||
login='exec login'
|
login='exec login'
|
||||||
nohup='nohup '
|
nohup='nohup '
|
||||||
r='fc -e -'
|
r='fc -e -'
|
||||||
|
source='PATH=$PATH:. command .'
|
||||||
stop='kill -STOP'
|
stop='kill -STOP'
|
||||||
suspend='kill -STOP $$'
|
suspend='kill -STOP $$'
|
||||||
type='whence -v'
|
type='whence -v'
|
||||||
|
3
main.c
3
main.c
@ -13,7 +13,7 @@
|
|||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.85 2007/08/12 13:42:21 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.86 2007/08/13 19:39:19 tg Exp $");
|
||||||
|
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
|
||||||
@ -49,6 +49,7 @@ static const char *initcoms_korn[] = {
|
|||||||
"history=fc -l",
|
"history=fc -l",
|
||||||
"nohup=nohup ",
|
"nohup=nohup ",
|
||||||
"r=fc -e -",
|
"r=fc -e -",
|
||||||
|
"source=PATH=$PATH:. 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 */
|
||||||
|
22
mksh.1
22
mksh.1
@ -1,4 +1,4 @@
|
|||||||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.95 2007/08/12 14:01:38 tg Exp $
|
.\" $MirOS: src/bin/mksh/mksh.1,v 1.96 2007/08/13 19:39:20 tg Exp $
|
||||||
.\" $OpenBSD: ksh.1,v 1.120 2007/05/31 20:47:44 otto Exp $
|
.\" $OpenBSD: ksh.1,v 1.120 2007/05/31 20:47:44 otto Exp $
|
||||||
.\"
|
.\"
|
||||||
.Dd August 12, 2007
|
.Dd August 12, 2007
|
||||||
@ -2379,6 +2379,9 @@ The following describes the special and regular built-in commands:
|
|||||||
.Pp
|
.Pp
|
||||||
.Bl -tag -width Ds -compact
|
.Bl -tag -width Ds -compact
|
||||||
.It Ic \&. Ar file Op Ar arg ...
|
.It Ic \&. Ar file Op Ar arg ...
|
||||||
|
This is called the
|
||||||
|
.Dq dot
|
||||||
|
command.
|
||||||
Execute the commands in
|
Execute the commands in
|
||||||
.Ar file
|
.Ar file
|
||||||
in the current environment.
|
in the current environment.
|
||||||
@ -3487,6 +3490,21 @@ etc.
|
|||||||
.Ar number
|
.Ar number
|
||||||
defaults to 1.
|
defaults to 1.
|
||||||
.Pp
|
.Pp
|
||||||
|
.It Ic source Ar file Op Ar arg ...
|
||||||
|
Like
|
||||||
|
.Ic \&. Po Do dot Dc Pc ,
|
||||||
|
except that the current working directory is appended to the
|
||||||
|
.Ev PATH
|
||||||
|
in GNU
|
||||||
|
.Nm bash
|
||||||
|
and
|
||||||
|
.Nm mksh .
|
||||||
|
In
|
||||||
|
.Nm ksh93
|
||||||
|
and
|
||||||
|
.Nm mksh ,
|
||||||
|
this is implemented as a shell alias instead of a builtin.
|
||||||
|
.Pp
|
||||||
.It Ic test Ar expression
|
.It Ic test Ar expression
|
||||||
.It Ic \&[ Ar expression Ic \&]
|
.It Ic \&[ Ar expression Ic \&]
|
||||||
.Ic test
|
.Ic test
|
||||||
@ -5352,7 +5370,7 @@ and many other persons, and is currently maintained by
|
|||||||
.An Thorsten Glaser Aq tg@mirbsd.de .
|
.An Thorsten Glaser Aq tg@mirbsd.de .
|
||||||
.Sh BUGS
|
.Sh BUGS
|
||||||
This document attempts to describe
|
This document attempts to describe
|
||||||
.Nm mksh R30b
|
.Nm mksh R31
|
||||||
and up,
|
and up,
|
||||||
compiled without any options impacting functionality, such as
|
compiled without any options impacting functionality, such as
|
||||||
.Dv MKSH_SMALL ,
|
.Dv MKSH_SMALL ,
|
||||||
|
4
sh.h
4
sh.h
@ -8,8 +8,8 @@
|
|||||||
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
|
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
|
||||||
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
|
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
|
||||||
|
|
||||||
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.169 2007/08/12 13:52:03 tg Exp $"
|
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.170 2007/08/13 19:39:21 tg Exp $"
|
||||||
#define MKSH_VERSION "R30 2007/08/12"
|
#define MKSH_VERSION "R30 2007/08/13"
|
||||||
|
|
||||||
#if HAVE_SYS_PARAM_H
|
#if HAVE_SYS_PARAM_H
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user