--- ed.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/ed.c b/ed.c index b661ac5..6da845a 100644 --- a/ed.c +++ b/ed.c _AT_@ -475,6 +475,24 @@ skipblank(void) back(c); } +static void +ensureblank(void) +{ + char c; + + switch ((c = input())) { + case ' ': + case '\t': + skipblank(); + case '\n': + back(c); + case EOF: + break; + default: + error("unknown command"); + } +} + static int getnum(void) { _AT_@ -1136,10 +1154,12 @@ repeat: case 'w': trunc = 1; case 'W': + ensureblank(); deflines(nextln(0), lastln); dowrite(getfname(cmd), trunc); break; case 'r': + ensureblank(); if (nlines > 1) goto bad_address; deflines(lastln, lastln); _AT_@ -1251,6 +1271,7 @@ repeat: quit(); break; case 'f': + ensureblank(); if (nlines > 0) goto unexpected; if (back(input()) != '\n') _AT_@ -1262,6 +1283,7 @@ repeat: case 'E': modflag = 0; case 'e': + ensureblank(); if (nlines > 0) goto unexpected; if (modflag) -- 2.42.0.rc1Received on Tue Sep 26 2023 - 08:17:00 CEST
This archive was generated by hypermail 2.3.0 : Tue Sep 26 2023 - 09:00:38 CEST