From 9018d1b5df052c7734f5af5987f0282168c3c96c Mon Sep 17 00:00:00 2001 From: martijn Date: Mon, 4 Jun 2018 13:26:21 +0000 Subject: [PATCH] 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@ --- bin/ed/glbl.c | 7 +------ bin/ed/main.c | 10 +--------- 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;