update ed help message to make s commands make more sense

This commit is contained in:
Murphy 2023-04-30 15:55:59 -04:00
parent fa3b1ef748
commit 5aff541fd7

View file

@ -748,6 +748,10 @@ test:
fprintf(stderr, "error: invalid number: %s\n", index); fprintf(stderr, "error: invalid number: %s\n", index);
break; break;
} }
if (matches < 1) {
fprintf(stderr, "error: matches cannot be less than 1\n");
break;
}
} }
long int sub_len = strlen(replace); long int sub_len = strlen(replace);
long int matches_found = 0; 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\n");
printf("\t\tQ\t\tquit file unconditionally\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($)\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(.,.)\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(.,.)\twq file\t\twrite contents of lines to file then quit\n");
printf("\t(.,.)\tW file\t\tappend contents of line to file\n"); printf("\t(.,.)\tW file\t\tappend contents of line to file\n");