Skip to content

Commit

Permalink
Merge pull request #158 from mknos/ed-helpmode
Browse files Browse the repository at this point in the history
ed: add H command
  • Loading branch information
briandfoy committed May 9, 2023
2 parents 7dd1cdc + 73e2c11 commit a4e9051
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions bin/ed
Expand Up @@ -235,6 +235,11 @@ while(<>) {
&edQuit($NO_QUESTIONS_MODE);
} elsif ($command eq 'h') {
print("$Error\n") if (defined $Error);
} elsif ($command eq 'H') {
$EXTENDED_MESSAGES ^= 1;
if ($EXTENDED_MESSAGES && defined $Error) {
print "$Error\n";
}
} elsif ($command eq 'n') {
edPrint(1);
}
Expand Down Expand Up @@ -761,7 +766,7 @@ sub edParse {
(([+-])?(\d+))? # [+]num | -num
(([\+]+)|([-^]+))? # + | -
)?
([acdeEfhinpPqQrswW=])? # command char
([acdeEfhHinpPqQrswW=])? # command char
\s*(\S+)? # argument (filename, etc.)
)$/x);

Expand Down Expand Up @@ -956,10 +961,9 @@ sub edWarn {
my $msg = shift;

$Error = $msg;
print "?\n";
if ($EXTENDED_MESSAGES) {
print "$msg\n";
} else {
print "?\n";
}
}

Expand Down

0 comments on commit a4e9051

Please sign in to comment.