summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2015-11-06 15:58:01 +0000
committernicm <nicm@openbsd.org>2015-11-06 15:58:01 +0000
commitbe1ba4b86ce4b27d42a5ceba73eaa6064a2f4ea4 (patch)
tree68c733ccad4a1f68f7ec917074ffa59c39c89782
parentGarrett D'Amore has agreed to moving his copyright line up above the (diff)
downloadwireguard-openbsd-be1ba4b86ce4b27d42a5ceba73eaa6064a2f4ea4.tar.xz
wireguard-openbsd-be1ba4b86ce4b27d42a5ceba73eaa6064a2f4ea4.zip
Remove support for ! to run a shell command, we have ^Z around these
parts. ok ratchov jung millert
-rw-r--r--usr.bin/less/cmd.h2
-rw-r--r--usr.bin/less/command.c33
-rw-r--r--usr.bin/less/decode.c1
-rw-r--r--usr.bin/less/less.117
-rw-r--r--usr.bin/less/lesskey.c1
5 files changed, 4 insertions, 50 deletions
diff --git a/usr.bin/less/cmd.h b/usr.bin/less/cmd.h
index 76c12fd6bfc..cd5277a1e74 100644
--- a/usr.bin/less/cmd.h
+++ b/usr.bin/less/cmd.h
@@ -37,7 +37,7 @@
#define A_QUIT 24
#define A_REPAINT 25
#define A_SETMARK 26
-#define A_SHELL 27
+/* 27 unused */
#define A_STAT 28
#define A_FF_LINE 29
#define A_BF_LINE 30
diff --git a/usr.bin/less/command.c b/usr.bin/less/command.c
index 4d881f037fa..2487a87507e 100644
--- a/usr.bin/less/command.c
+++ b/usr.bin/less/command.c
@@ -50,7 +50,6 @@ extern int shift_count;
extern int oldbot;
extern int forw_prompt;
-static char *shellcmd = NULL; /* For holding last shell command for "!!" */
static int mca; /* The multicharacter command (action) */
static int search_type; /* The previous type of search */
static LINENUM number; /* The number typed by the user */
@@ -243,25 +242,6 @@ exec_mca(void)
/* If tag structure is loaded then clean it up. */
cleantags();
break;
- case A_SHELL:
- /*
- * !! just uses whatever is in shellcmd.
- * Otherwise, copy cmdbuf to shellcmd,
- * expanding any special characters ("%" or "#").
- */
- if (*cbuf != '!') {
- if (shellcmd != NULL)
- free(shellcmd);
- shellcmd = fexpand(cbuf);
- }
-
- if (secure)
- break;
- if (shellcmd == NULL)
- lsystem("", "!done");
- else
- lsystem(shellcmd, "!done");
- break;
case A_PIPE:
if (secure)
break;
@@ -1435,7 +1415,6 @@ again:
error("WARNING: This file was viewed via "
"LESSOPEN", NULL_PARG);
}
- start_mca(A_SHELL, "!", ml_shell, 0);
/*
* Expand the editor prototype string
* and pass it to the system to execute.
@@ -1563,18 +1542,6 @@ again:
c = getcc();
goto again;
- case A_SHELL:
- /*
- * Shell escape.
- */
- if (secure) {
- error("Command not available", NULL_PARG);
- break;
- }
- start_mca(A_SHELL, "!", ml_shell, 0);
- c = getcc();
- goto again;
-
case A_SETMARK:
/*
* Set a mark.
diff --git a/usr.bin/less/decode.c b/usr.bin/less/decode.c
index 901774390f7..50e1da8da8f 100644
--- a/usr.bin/less/decode.c
+++ b/usr.bin/less/decode.c
@@ -150,7 +150,6 @@ static unsigned char cmdtable[] =
':', 't', 0, A_OPT_TOGGLE|A_EXTRA, 't', 0,
'|', 0, A_PIPE,
'v', 0, A_VISUAL,
- '!', 0, A_SHELL,
'+', 0, A_FIRSTCMD,
'H', 0, A_HELP,
diff --git a/usr.bin/less/less.1 b/usr.bin/less/less.1
index bf6ff3e334d..a3c3d088ffc 100644
--- a/usr.bin/less/less.1
+++ b/usr.bin/less/less.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: less.1,v 1.45 2014/11/23 09:56:32 jmc Exp $
+.\" $OpenBSD: less.1,v 1.46 2015/11/06 15:58:01 nicm Exp $
.\"
.\" Copyright (C) 1984-2012 Mark Nudelman
.\"
@@ -23,7 +23,7 @@
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: November 23 2014 $
+.Dd $Mdocdate: November 6 2015 $
.Dt LESS 1
.Os
.Sh NAME
@@ -1144,15 +1144,6 @@ is defined.
See also the discussion of LESSEDIT under the section on
.Sx PROMPTS
below.
-.It Ic \&! Ar shell-command
-Invokes a shell to run the shell-command given.
-A percent sign (%) in the command is replaced by the name of the current file.
-A pound sign (#) is replaced by the name of the previously examined file.
-"!!" repeats the last shell command.
-"!" with no shell command simply invokes a shell.
-The shell is taken from the environment variable
-.Ev SHELL ,
-or defaults to "sh".
.It Ic | <m> Ar shell-command
<m> represents any mark letter.
Pipes a section of the input file to the given shell command.
@@ -1788,8 +1779,6 @@ is set to 1,
runs in a "secure" mode.
This means these features are disabled:
.Bl -tag -width Ds
-.It \&!
-The shell command.
.It |
The pipe command.
.It :e
@@ -2009,7 +1998,7 @@ automatically when running in
.Xr more 1
compatible mode.
.It Ev SHELL
-The shell used to execute the ! command, as well as to expand filenames.
+The shell used to expand filenames.
.It Ev TERM
Specifies the terminal type.
Used by
diff --git a/usr.bin/less/lesskey.c b/usr.bin/less/lesskey.c
index aa97a297081..c639651014d 100644
--- a/usr.bin/less/lesskey.c
+++ b/usr.bin/less/lesskey.c
@@ -147,7 +147,6 @@ struct cmdname cmdnames[] =
{ "reverse-search-all", A_T_REVERSE_SEARCH },
{ "right-scroll", A_RSHIFT },
{ "set-mark", A_SETMARK },
- { "shell", A_SHELL },
{ "status", A_STAT },
{ "toggle-flag", A_OPT_TOGGLE },
{ "toggle-option", A_OPT_TOGGLE },