introduce MKSH_NO_EXTERNAL_CAT skipping the “call /bin/cat if we have an

option” nonsense, intended for Android, Plan 9, and other systems which
honour that cat -v is deemed harmful
This commit is contained in:
tg 2011-07-07 21:24:53 +00:00
parent 3f014c8daf
commit 851f8fb7d8
3 changed files with 10 additions and 6 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.483 2011/06/12 15:54:42 tg Exp $'
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.484 2011/07/07 21:24:51 tg Exp $'
#-
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
# Thorsten Glaser <tg@mirbsd.org>
@ -31,7 +31,7 @@ srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.483 2011/06/12 15:54:42 tg Exp $'
# MKSH_UNEMPLOYED MKSH_DEFAULT_EXECSHELL MKSHRC_PATH
# MKSH_DEFAULT_TMPDIR MKSH_CLRTOEOL_STRING MKSH_A4PB
# MKSH_NO_DEPRECATED_WARNING MKSH_DONT_EMIT_IDSTRING
# MKSH_NOPROSPECTOFWORK
# MKSH_NOPROSPECTOFWORK MKSH_NO_EXTERNAL_CAT
LC_ALL=C
export LC_ALL

4
exec.c
View File

@ -22,7 +22,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.93 2011/07/05 20:12:17 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.94 2011/07/07 21:24:52 tg Exp $");
#ifndef MKSH_DEFAULT_EXECSHELL
#define MKSH_DEFAULT_EXECSHELL "/bin/sh"
@ -588,6 +588,7 @@ comexec(struct op *t, struct tbl * volatile tp, const char **ap,
subst_exstat = 0;
break;
}
#ifndef MKSH_NO_EXTERNAL_CAT
} else if (tp->val.f == c_cat) {
/*
* if we have any flags, do not use the builtin
@ -605,6 +606,7 @@ comexec(struct op *t, struct tbl * volatile tp, const char **ap,
else
/* go on, use the builtin */
break;
#endif
} else
break;
tp = findcom(ap[0], fcflags & (FC_BI|FC_FUNC));

8
mksh.1
View File

@ -1,4 +1,4 @@
.\" $MirOS: src/bin/mksh/mksh.1,v 1.268 2011/07/06 22:21:58 tg Exp $
.\" $MirOS: src/bin/mksh/mksh.1,v 1.269 2011/07/07 21:24:53 tg Exp $
.\" $OpenBSD: ksh.1,v 1.140 2011/04/23 10:14:59 sobrado Exp $
.\"-
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
@ -72,7 +72,7 @@
.\" with -mandoc, it might implement .Mx itself, but we want to
.\" use our own definition. And .Dd must come *first*, always.
.\"
.Dd $Mdocdate: July 6 2011 $
.Dd $Mdocdate: July 7 2011 $
.\"
.\" Check which macro package we use
.\"
@ -3066,7 +3066,9 @@ If a
is a single dash
.Pq Sq -
or absent, read from standard input.
If any options are given, an external
Unless compiled with
.Dv MKSH_NO_EXTERNAL_CAT ,
if any options are given, an external
.Xr cat 1
utility is invoked instead if called from the shell.
For direct builtin calls, the