Skip to content

Commit 28dcd04

Browse files
authored
ed: honour -s flag for w & e commands (briandfoy#931)
* In BSD ed, the -s flag is for running an ed script * Modified buffers don't prevent the editor from quitting or editing a new file in this mode * GNU ed doesn't seem to follow this, but to me the GNU interpretation seems inconsistent with the meaning of -s
1 parent 6228571 commit 28dcd04

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

bin/ed

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ my $UndoLine;
100100
my $PRINT_NUM = 1;
101101
my $PRINT_BIN = 2;
102102

103-
our $VERSION = '0.27';
103+
our $VERSION = '0.28';
104104

105105
my @ESC = (
106106
'\\000', '\\001', '\\002', '\\003', '\\004', '\\005', '\\006', '\\a',
@@ -744,7 +744,7 @@ sub edEdit {
744744
my(@tmp_lines, $chars, $fh, $filename);
745745

746746
return E_ADDREXT if defined($adrs[0]) or defined($adrs[1]);
747-
if ($NeedToSave && $QuestionsMode && !$UserHasBeenWarned) {
747+
if ($NeedToSave && $QuestionsMode && !$UserHasBeenWarned && !$Scripted) {
748748
$UserHasBeenWarned = 1;
749749
return E_UNSAVED;
750750
}
@@ -913,7 +913,7 @@ sub edQuit {
913913
return E_ADDREXT if defined $adrs[0];
914914
return E_ARGEXT if defined $args[0];
915915

916-
if ($QuestionMode && $NeedToSave && !$UserHasBeenWarned) {
916+
if ($QuestionMode && $NeedToSave && !$UserHasBeenWarned && !$Scripted) {
917917
$UserHasBeenWarned = 1;
918918
return E_UNSAVED;
919919
}

0 commit comments

Comments
 (0)