summaryrefslogtreecommitdiff
path: root/src/commands/ed.c
diff options
context:
space:
mode:
authorTyler Murphy <tylerm@tylerm.dev>2023-04-30 15:55:59 -0400
committerTyler Murphy <tylerm@tylerm.dev>2023-04-30 15:55:59 -0400
commit5aff541fd7a996f7926f06ab0127920a1789203a (patch)
treef82b6d108250c291dd31142f48656f117b4b99dd /src/commands/ed.c
parentupdate help messages and use addressing range for ed s command (diff)
downloadlazysphere-5aff541fd7a996f7926f06ab0127920a1789203a.tar.gz
lazysphere-5aff541fd7a996f7926f06ab0127920a1789203a.tar.bz2
lazysphere-5aff541fd7a996f7926f06ab0127920a1789203a.zip
update ed help message to make s commands make more sense
Diffstat (limited to '')
-rw-r--r--src/commands/ed.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/commands/ed.c b/src/commands/ed.c
index 87dd580..ca25de1 100644
--- a/src/commands/ed.c
+++ b/src/commands/ed.c
@@ -748,6 +748,10 @@ test:
fprintf(stderr, "error: invalid number: %s\n", index);
break;
}
+ if (matches < 1) {
+ fprintf(stderr, "error: matches cannot be less than 1\n");
+ break;
+ }
}
long int sub_len = strlen(replace);
long int matches_found = 0;
@@ -827,7 +831,9 @@ static void help() {
printf("\t\tq\t\tquit file\n");
printf("\t\tQ\t\tquit file unconditionally\n");
printf("\t($)\tr file\t\tread file and append to end of buffer\n");
- printf("\t(.,.)\ts/re/replace/\treplace text at matching regex\n");
+ printf("\t(.,.)\ts/re/replace/\treplace the first match on each matching line\n");
+ printf("\t(.,.)\ts/re/replace/g\treplace all matches on each matching line\n");
+ printf("\t(.,.)\ts/re/replace/n\treplace n matches on each matching line\n");
printf("\t(.,.)\tw file\t\twrite contents of lines to file\n");
printf("\t(.,.)\twq file\t\twrite contents of lines to file then quit\n");
printf("\t(.,.)\tW file\t\tappend contents of line to file\n");