1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-03 06:45:37 -08:00

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@
This commit is contained in:
martijn 2018-06-04 13:26:21 +00:00
parent 3f2d79b34b
commit 9018d1b5df
2 changed files with 2 additions and 15 deletions

View File

@ -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)

View File

@ -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;