--- ed.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/ed.c b/ed.c index 8951d4b..dcd91d1 100644 --- a/ed.c +++ b/ed.c _AT_@ -887,38 +887,37 @@ quit(void) static void execsh(void) { - static char *cmd; - static size_t siz, cap; + static String cmd; char c, *p; int repl = 0; skipblank(); if ((c = input()) != '!') { back(c); - siz = 0; - } else if (cmd) { - --siz; + cmd.siz = 0; + } else if (cmd.siz) { + --cmd.siz; repl = 1; } else { error("no previous command"); } while ((c = input()) != EOF && c != '\n') { - if (c == '%' && (siz == 0 || cmd[siz - 1] != '\\')) { + if (c == '%' && (cmd.siz == 0 || cmd.str[cmd.siz - 1] != '\\')) { if (savfname[0] == '\0') error("no current filename"); repl = 1; for (p = savfname; *p; ++p) - cmd = addchar(*p, cmd, &cap, &siz); + addchar_(*p, &cmd); } else { - cmd = addchar(c, cmd, &cap, &siz); + addchar_(c, &cmd); } } - cmd = addchar('\0', cmd, &cap, &siz); + addchar_('\0', &cmd); if (repl) - puts(cmd); - system(cmd); + puts(cmd.str); + system(cmd.str); if (optdiag) puts("!"); } -- 2.14.2Received on Tue Mar 06 2018 - 12:57:59 CET
This archive was generated by hypermail 2.3.0 : Tue Mar 06 2018 - 13:02:08 CET