diff options
author | thing1 <thing1@seacrossedlovers.xyz> | 2025-02-13 07:04:26 +0000 |
---|---|---|
committer | thing1 <thing1@seacrossedlovers.xyz> | 2025-02-13 07:04:26 +0000 |
commit | d227da1d02fa94b3c0ce8b4844c2790b6084917d (patch) | |
tree | ddaf0af8c653327eeb4c695c68ad3998358a5f33 /ed.c | |
parent | 3e98690fd3267b61385c1bbce1f8abdc51ae742a (diff) |
Diffstat (limited to 'ed.c')
-rw-r--r-- | ed.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -22,6 +22,7 @@ void eprint(char *str) { } void readcmd() { + printf("%d > ", lineno); char c; while ((c = getchar()) != '\n' && cmdlen <= MAXCMD) { command[cmdlen] = c; @@ -97,12 +98,18 @@ void runcmd(char *outpath) { int n; if ((n = readnum()) != -1) { - if (n > linecount) printf("?\n"); + if (n > linecount) { + printf("?\n"); + goto repeat; + } lineno = n; - return; } - switch (command[0]) { + int i = 0; +repeat: + switch (command[i]) { + case 0: + return; case 'd': deleteline(lineno); break; @@ -120,6 +127,8 @@ void runcmd(char *outpath) { case 'q': exit(1); } + i++; + goto repeat; } int main(int argc, char **argv) { |