Hello tech@,
POSIX states:
An empty command list shall be equivalent to the p command
And says nothing about changing the behaviour of a null-command as part
of the command list. So I think the current behaviour is correct.
OK?
martijn@
Index: glbl.c
===================================================================
RCS file: /cvs/src/bin/ed/glbl.c,v
retrieving revision 1.19
diff -u -p -r1.19 glbl.c
--- glbl.c 26 Apr 2017 21:25:43 -0000 1.19
+++ glbl.c 4 Jun 2018 06:40:55 -0000
@@ -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)
Index: main.c
===================================================================
RCS file: /cvs/src/bin/ed/main.c,v
retrieving revision 1.62
diff -u -p -r1.62 main.c
--- main.c 24 May 2018 06:24:29 -0000 1.62
+++ main.c 4 Jun 2018 06:40:55 -0000
@@ -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;