Otherwise, if ed's output is not line buffered (e.g. if it is
redirected to a file or pipe) the shell command output may be
displayed before data buffered by ed itself is written.
From Soeren Tempel. OK deraadt@
-/* $OpenBSD: main.c,v 1.66 2019/06/28 13:34:59 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.67 2022/01/22 23:22:11 millert 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
return ERR;
GET_COMMAND_SUFFIX();
if (sflags) printf("%s\n", shcmd + 1);
+ fflush(NULL); /* flush any buffered I/O */
system(shcmd + 1);
if (!scripted) printf("!\n");
break;