Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ed: standard exit code #863

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions bin/ed
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ my $NO_QUESTIONS_MODE = 0;
my $PRINT_NUM = 1;
my $PRINT_BIN = 2;

our $VERSION = '0.20';
our $VERSION = '0.21';

my @ESC = (
'\\000', '\\001', '\\002', '\\003', '\\004', '\\005', '\\006', '\\a',
Expand Down Expand Up @@ -275,6 +275,11 @@ sub maxline {
return $n;
}

sub getrc {
return EX_FAILURE if defined $Error;
return EX_SUCCESS;
}

sub edChangeLines {
my $err = edDelete();
unless ($err) {
Expand Down Expand Up @@ -646,7 +651,7 @@ sub edWrite {

$NeedToSave = $UserHasBeenWarned = 0;
print "$chars\n" unless $Scripted;
exit EX_SUCCESS if $qflag;
exit getrc() if $qflag;
return;
}

Expand Down Expand Up @@ -815,7 +820,7 @@ sub edQuit {
$UserHasBeenWarned = 1;
return E_UNSAVED;
}
exit EX_SUCCESS;
exit getrc();
}

#
Expand Down Expand Up @@ -1240,6 +1245,16 @@ Display current line number

=back

=head1 EXIT STATUS

=over 4

=item * 0 - All commands were processed successfully

=item * 1 - An error occurred

=back

=head1 AUTHOR

Written by George M Jones
Expand Down
Loading