summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormartijn <martijn@openbsd.org>2018-06-04 13:26:21 +0000
committermartijn <martijn@openbsd.org>2018-06-04 13:26:21 +0000
commit9018d1b5df052c7734f5af5987f0282168c3c96c (patch)
tree3ad0ff87e41ddc4f2d5b906d42123d201e3ecfa4
parentThe function pf_create_state() calls pf_set_protostate() before (diff)
downloadwireguard-openbsd-9018d1b5df052c7734f5af5987f0282168c3c96c.tar.xz
wireguard-openbsd-9018d1b5df052c7734f5af5987f0282168c3c96c.zip
Definitively choose the existing semantics for the scroll and null command.
POSIX states: "An empty command list shall be equivalent to the p command", so changing the behaviour of a null-command in any other case is a violation of POSIX. OK millert@
-rw-r--r--bin/ed/glbl.c7
-rw-r--r--bin/ed/main.c10
2 files changed, 2 insertions, 15 deletions
diff --git a/bin/ed/glbl.c b/bin/ed/glbl.c
index 27ebc0c6852..90e602c1dc2 100644
--- a/bin/ed/glbl.c
+++ b/bin/ed/glbl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: glbl.c,v 1.19 2017/04/26 21:25:43 naddy Exp $ */
+/* $OpenBSD: glbl.c,v 1.20 2018/06/04 13:26:21 martijn Exp $ */
/* $NetBSD: glbl.c,v 1.2 1995/03/21 09:04:41 cgd Exp $ */
/* glob.c: This file contains the global command routines for the ed line
@@ -88,17 +88,12 @@ exec_global(int interact, int gflag)
int n;
char *cmd = NULL;
-#ifdef BACKWARDS
if (!interact) {
if (!strcmp(ibufp, "\n"))
cmd = "p\n"; /* null cmd-list == `p' */
else if ((cmd = get_extended_line(&n, 0)) == NULL)
return ERR;
}
-#else
- if (!interact && (cmd = get_extended_line(&n, 0)) == NULL)
- return ERR;
-#endif
clear_undo_stack();
while ((lp = next_active_node()) != NULL) {
if ((current_addr = get_line_node_addr(lp)) < 0)
diff --git a/bin/ed/main.c b/bin/ed/main.c
index 9aa5342b29c..b84317b88db 100644
--- a/bin/ed/main.c
+++ b/bin/ed/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.62 2018/05/24 06:24:29 martijn Exp $ */
+/* $OpenBSD: main.c,v 1.63 2018/06/04 13:26:21 martijn Exp $ */
/* $NetBSD: main.c,v 1.3 1995/03/21 09:04:44 cgd Exp $ */
/* main.c: This file contains the main control and user-interface routines
@@ -851,11 +851,7 @@ exec_command(void)
return ERR;
case 'z':
first_addr = 1;
-#ifdef BACKWARDS
if (check_addr_range(first_addr, current_addr + 1) < 0)
-#else
- if (check_addr_range(first_addr, current_addr + !isglobal) < 0)
-#endif
return ERR;
else if ('0' < *ibufp && *ibufp <= '9')
STRTOI(rows, ibufp);
@@ -882,11 +878,7 @@ exec_command(void)
break;
case '\n':
first_addr = 1;
-#ifdef BACKWARDS
if (check_addr_range(first_addr, current_addr + 1) < 0
-#else
- if (check_addr_range(first_addr, current_addr + !isglobal) < 0
-#endif
|| display_lines(second_addr, second_addr, 0) < 0)
return ERR;
break;