implement cat thing for realpath and rename too: if flag, call external
This commit is contained in:
parent
b478d334d9
commit
b9a8fdf905
4
Build.sh
4
Build.sh
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.679 2015/05/01 16:08:26 tg Exp $'
|
||||
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.680 2015/07/05 15:45:16 tg Exp $'
|
||||
#-
|
||||
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||
# 2011, 2012, 2013, 2014, 2015
|
||||
@ -2646,6 +2646,8 @@ MKSH_NOPWNAM skip PAM calls, for -static on glibc or Solaris
|
||||
MKSH_NO_CMDLINE_EDITING disable command line editing code entirely
|
||||
MKSH_NO_DEPRECATED_WARNING omit warning when deprecated stuff is run
|
||||
MKSH_NO_EXTERNAL_CAT omit hack to skip cat builtin when flags passed
|
||||
MKSH_NO_EXTERNAL_REALPATH same for realpath builtin
|
||||
MKSH_NO_EXTERNAL_RENAME same for rename builtin
|
||||
MKSH_NO_LIMITS omit ulimit code
|
||||
MKSH_NO_SIGSETJMP define if sigsetjmp is broken or not available
|
||||
MKSH_NO_SIGSUSPEND use sigprocmask+pause instead of sigsuspend
|
||||
|
25
exec.c
25
exec.c
@ -23,7 +23,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.153 2015/07/05 14:43:05 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.154 2015/07/05 15:45:17 tg Exp $");
|
||||
|
||||
#ifndef MKSH_DEFAULT_EXECSHELL
|
||||
#define MKSH_DEFAULT_EXECSHELL "/bin/sh"
|
||||
@ -607,16 +607,21 @@ comexec(struct op *t, struct tbl * volatile tp, const char **ap,
|
||||
subst_exstat = 0;
|
||||
break;
|
||||
}
|
||||
#if !defined(MKSH_NO_EXTERNAL_CAT) || \
|
||||
!defined(MKSH_NO_EXTERNAL_REALPATH) || \
|
||||
!defined(MKSH_NO_EXTERNAL_RENAME)
|
||||
} else if (
|
||||
#ifndef MKSH_NO_EXTERNAL_CAT
|
||||
} else if (tp->val.f == c_cat) {
|
||||
/*
|
||||
* if we have any flags, do not use the builtin
|
||||
* in theory, we could allow -u, but that would
|
||||
* mean to use ksh_getopt here and possibly ad-
|
||||
* ded complexity and more code and isn't worth
|
||||
* additional hassle (and the builtin must call
|
||||
* ksh_getopt already but can't come back here)
|
||||
*/
|
||||
tp->val.f == c_cat ||
|
||||
#endif
|
||||
#ifndef MKSH_NO_EXTERNAL_REALPATH
|
||||
tp->val.f == c_realpath ||
|
||||
#endif
|
||||
#ifndef MKSH_NO_EXTERNAL_RENAME
|
||||
tp->val.f == c_rename ||
|
||||
#endif
|
||||
0) {
|
||||
/* if we have any flags, do not use the builtin */
|
||||
if (ap[1] && ap[1][0] == '-' && ap[1][1] != '\0' &&
|
||||
/* argument, begins with -, is not - or -- */
|
||||
(ap[1][1] != '-' || ap[1][2] != '\0'))
|
||||
|
13
mksh.1
13
mksh.1
@ -1,4 +1,4 @@
|
||||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.369 2015/07/05 15:22:41 tg Exp $
|
||||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.370 2015/07/05 15:45:18 tg Exp $
|
||||
.\" $OpenBSD: ksh.1,v 1.160 2015/07/04 13:27:04 feinerer Exp $
|
||||
.\"-
|
||||
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
||||
@ -3957,6 +3957,12 @@ it's also checked for existence and whether it is a directory; otherwise,
|
||||
returns 0 if the pathname either exists or can be created immediately,
|
||||
i.e. all but the last component exist and are directories.
|
||||
.Pp
|
||||
Unless compiled with
|
||||
.Dv MKSH_NO_EXTERNAL_REALPATH ,
|
||||
if any options are given and this is not a direct builtin call, an external
|
||||
.Xr realpath 1
|
||||
utility is invoked instead.
|
||||
.Pp
|
||||
.It Xo
|
||||
.Ic rename
|
||||
.Op Fl \-
|
||||
@ -3971,6 +3977,11 @@ This builtin is intended for emergency situations where
|
||||
.Pa /bin/mv
|
||||
becomes unusable, and directly calls
|
||||
.Xr rename 2 .
|
||||
Unless compiled with
|
||||
.Dv MKSH_NO_EXTERNAL_RENAME ,
|
||||
if any options are given and this is not a direct builtin call, an external
|
||||
.Xr rename 1
|
||||
utility is invoked instead.
|
||||
.Pp
|
||||
.It Ic return Op Ar status
|
||||
Returns from a function or
|
||||
|
Loading…
Reference in New Issue
Block a user