Skip to content

Commit

Permalink
ed: 2-address insert command
Browse files Browse the repository at this point in the history
* When testing against GNU and OpenBSD versions, "i" command was with a 2-address prefix was treated as invalid
* Be compatible and treat effective address as 2nd address if 2 were specified
* ed commands "a" and "i" are both handled in edInsert(), so this patch covers both
* test1: "1,2i" --> 2i
* test2: ",2i" --> 2i
* test3: "1,2a" --> 2a
* test4: ",2a" --> 2a
  • Loading branch information
mknos authored Jun 16, 2024
1 parent af39cd4 commit 5c3e23c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions bin/ed
Original file line number Diff line number Diff line change
Expand Up @@ -749,14 +749,13 @@ sub edInsert {
my $append = shift;
my(@tmp_lines);

if (defined($adrs[1])) {
edWarn(E_ADDREXT);
return;
}
if (defined($args[0])) {
edWarn(E_ARGEXT);
return;
}
if (defined($adrs[1])) {
$adrs[0] = $adrs[1];
}
if (!defined($adrs[0])) {
$adrs[0] = $CurrentLineNum;
}
Expand Down

0 comments on commit 5c3e23c

Please sign in to comment.