add the chdir builtin from mircvs://contrib/hosted/tg/deb/mksh/ for

better dash compatibility (mksh is now a dash superset if printf is
compiled in)
This commit is contained in:
tg 2009-08-30 21:02:01 +00:00
parent e622d80394
commit 4a4be7d313
4 changed files with 22 additions and 10 deletions

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.301 2009/08/28 22:46:19 tg Exp $ # $MirOS: src/bin/mksh/check.t,v 1.302 2009/08/30 21:01:59 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 $
@ -25,7 +25,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 R39 2009/08/28 @(#)MIRBSD KSH R39 2009/08/30
description: description:
Check version of shell. Check version of shell.
stdin: stdin:

View File

@ -25,7 +25,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.127 2009/08/30 13:30:07 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.128 2009/08/30 21:02:00 tg Exp $");
#if HAVE_KILLPG #if HAVE_KILLPG
/* /*
@ -77,6 +77,7 @@ const struct builtin mkshbuiltins[] = {
{"*=unset", c_unset}, {"*=unset", c_unset},
{"+alias", c_alias}, /* no =: AT&T manual wrong */ {"+alias", c_alias}, /* no =: AT&T manual wrong */
{"+cd", c_cd}, {"+cd", c_cd},
{"chdir", c_cd}, /* dash compatibility hack */
{"+command", c_command}, {"+command", c_command},
{"echo", c_print}, {"echo", c_print},
{"*=export", c_typeset}, {"*=export", c_typeset},

21
mksh.1
View File

@ -1,4 +1,4 @@
.\" $MirOS: src/bin/mksh/mksh.1,v 1.178 2009/08/30 11:38:44 tg Exp $ .\" $MirOS: src/bin/mksh/mksh.1,v 1.179 2009/08/30 21:02:00 tg Exp $
.\" $OpenBSD: ksh.1,v 1.129 2009/05/28 06:09:06 jmc Exp $ .\" $OpenBSD: ksh.1,v 1.129 2009/05/28 06:09:06 jmc Exp $
.\"- .\"-
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 .\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
@ -156,6 +156,7 @@ files:
.It .It
The The
.Ic cd .Ic cd
.Po and Ic chdir Pc
command is disabled. command is disabled.
.It .It
The The
@ -2556,10 +2557,10 @@ Additional
.Nm .Nm
regular commands regular commands
.Pp .Pp
.Ic \&[ , bind , echo , let , .Ic \&[ , chdir , bind , echo ,
.Ic mknod , print , printf , pwd , .Ic let , mknod , print , printf ,
.Ic realpath , rename , test , ulimit , .Ic pwd , realpath , rename , test ,
.Ic whence .Ic ulimit , whence
.Pp .Pp
In the future, the additional In the future, the additional
.Nm .Nm
@ -2743,6 +2744,11 @@ Execute the built-in command
.Op Fl LP .Op Fl LP
.Op Ar dir .Op Ar dir
.Xc .Xc
.It Xo
.Ic chdir
.Op Fl LP
.Op Ar dir
.Xc
Set the working directory to Set the working directory to
.Ar dir . .Ar dir .
If the parameter If the parameter
@ -2802,6 +2808,11 @@ respectively.
.Op Fl LP .Op Fl LP
.Ar old new .Ar old new
.Xc .Xc
.It Xo
.Ic chdir
.Op Fl LP
.Ar old new
.Xc
The string The string
.Ar new .Ar new
is substituted for is substituted for

4
sh.h
View File

@ -134,9 +134,9 @@
#endif #endif
#ifdef EXTERN #ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.336 2009/08/30 13:30:08 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/sh.h,v 1.337 2009/08/30 21:02:01 tg Exp $");
#endif #endif
#define MKSH_VERSION "R39 2009/08/28" #define MKSH_VERSION "R39 2009/08/30"
#ifndef MKSH_INCLUDES_ONLY #ifndef MKSH_INCLUDES_ONLY