@@ -79,6 +79,9 @@ use constant E_PATTERN => 'invalid pattern delimiter';
79
79
use constant E_NOMATCH => ' no match' ;
80
80
use constant E_NOPAT => ' no previous pattern' ;
81
81
82
+ use constant EX_SUCCESS => 0;
83
+ use constant EX_FAILURE => 1;
84
+
82
85
# important globals
83
86
84
87
my $CurrentLineNum = 0; # default to before first line.
@@ -109,7 +112,7 @@ my $NO_QUESTIONS_MODE = 0;
109
112
my $PRINT_NUM = 1;
110
113
my $PRINT_BIN = 2;
111
114
112
- our $VERSION = ' 0.14 ' ;
115
+ our $VERSION = ' 0.15 ' ;
113
116
114
117
my @ESC = (
115
118
' \\ 000' , ' \\ 001' , ' \\ 002' , ' \\ 003' , ' \\ 004' , ' \\ 005' , ' \\ 006' , ' \\ a' ,
@@ -193,11 +196,11 @@ $SIG{HUP} = sub {
193
196
close $fh ;
194
197
}
195
198
}
196
- exit 1 ;
199
+ exit EX_FAILURE ;
197
200
};
198
201
199
202
my %opt ;
200
- getopts(' dp :s' , \%opt ) or Usage();
203
+ getopts(' p :s' , \%opt ) or Usage();
201
204
if (defined $opt {' p' }) {
202
205
$Prompt = $opt {' p' };
203
206
}
@@ -223,14 +226,6 @@ sub input {
223
226
edWarn(E_CMDBAD);
224
227
return ;
225
228
}
226
- if ($opt {' d' }) {
227
- print " command: /$command / " ;
228
- print " adrs[0]: /$adrs [0]/ " if defined ($adrs [0]);
229
- print " adrs[1]: /$adrs [1]/ " if defined ($adrs [1]);
230
- print " args[0]: /$args [0]/ " if defined ($args [0]);
231
- print " \n " ;
232
- }
233
-
234
229
# sanity check addresses
235
230
foreach my $ad (@adrs ) {
236
231
next unless defined $ad ;
@@ -265,7 +260,7 @@ sub input {
265
260
266
261
sub VERSION_MESSAGE {
267
262
print " ed version $VERSION \n " ;
268
- exit 0 ;
263
+ exit EX_SUCCESS ;
269
264
}
270
265
271
266
sub maxline {
@@ -662,7 +657,7 @@ sub edWrite {
662
657
print " $chars \n " unless ($SupressCounts );
663
658
664
659
if ($qflag ) {
665
- exit 0 ;
660
+ exit EX_SUCCESS ;
666
661
}
667
662
}
668
663
@@ -851,8 +846,7 @@ sub edQuit {
851
846
edWarn(E_UNSAVED);
852
847
return ;
853
848
}
854
-
855
- exit 0;
849
+ exit EX_SUCCESS;
856
850
}
857
851
858
852
#
@@ -1100,7 +1094,8 @@ sub edSearchGlobal {
1100
1094
}
1101
1095
1102
1096
sub Usage {
1103
- die " Usage: ed [-p prompt] [-ds] [file]\n " ;
1097
+ print " usage: ed [-p prompt] [-s] [file]\n " ;
1098
+ exit EX_FAILURE;
1104
1099
}
1105
1100
1106
1101
#
@@ -1129,7 +1124,7 @@ ed - text editor
1129
1124
1130
1125
=head1 SYNOPSIS
1131
1126
1132
- ed [-p prompt] [-ds ] [file]
1127
+ ed [-p prompt] [-s ] [file]
1133
1128
1134
1129
=head1 DESCRIPTION
1135
1130
@@ -1170,10 +1165,6 @@ The following options are available:
1170
1165
1171
1166
=over 4
1172
1167
1173
- =item -d
1174
-
1175
- Print debugging information on standard output.
1176
-
1177
1168
=item -p STRING
1178
1169
1179
1170
Use the specified STRING as a command prompt.
0 commit comments