summaryrefslogtreecommitdiff
path: root/lib/complete.pl
diff options
context:
space:
mode:
authorLarry Wall <lwall@jpl-devvax.jpl.nasa.gov>1991-01-11 05:47:59 +0000
committerLarry Wall <lwall@jpl-devvax.jpl.nasa.gov>1991-01-11 05:47:59 +0000
commit7e1cf235bd6c3a4fbf1093f84db8002929b8b6c6 (patch)
treeb40f89bf7894e94dab7bb84fc004eb03bd4b904a /lib/complete.pl
parent4e8eb4f0f838674cc353c6a5ff3e06ff40cd5ea9 (diff)
downloadperl-7e1cf235bd6c3a4fbf1093f84db8002929b8b6c6.tar.gz
perl 3.0 patch #42 (combined patch)
Most of these patches are pretty self-explanatory. Much of this is random cleanup in preparation for version 4.0, so I won't talk about it here. A couple of things should be noted, however. First, there's a new -0 option that allows you to specify (in octal) the initial value of $/, the record separator. It's primarily intended for use with versions of find that support -print0 to delimit filenames with nulls, but it's more general than that: null ^A default CR paragraph mode file slurp mode This feature is so new that it didn't even make it into the book. The other major item is that different patchlevels of perl can now coexist in your bin directory. The names "perl" and "taintperl" are just links to "perl3.044" and "tperl3.044". This has several benefits. The perl3.044 invokes the corresponding tperl3.044 rather than taintperl, so it always runs the correct version. Second, you can "freeze" a script by putting a #! line referring to a version that it is known to work with. Third, you can put a new version out there to try out before making it the default perl. Lastly, it sells more disk drives. :-) Barring catastrophe, this will likely be the last patch before version 4.0 comes out.
Diffstat (limited to 'lib/complete.pl')
-rw-r--r--lib/complete.pl19
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/complete.pl b/lib/complete.pl
index b59bee32ee..73d3649f8d 100644
--- a/lib/complete.pl
+++ b/lib/complete.pl
@@ -7,6 +7,7 @@
;# This routine provides word completion.
;# (TAB) attempts word completion.
;# (^D) prints completion list.
+;# (These may be changed by setting $Complete'complete, etc.)
;#
;# Diagnostics:
;# Bell when word completion fails.
@@ -15,13 +16,23 @@
;# The tty driver is put into raw mode.
;#
;# Bugs:
-;# The erase and kill characters are hard coded.
;#
;# Usage:
;# $input = do Complete('prompt_string', @completion_list);
;#
+CONFIG: {
+ package Complete;
+
+ $complete = "\004";
+ $kill = "\025";
+ $erase1 = "\177";
+ $erase2 = "\010";
+}
+
sub Complete {
+ package Complete;
+
local ($prompt) = shift (@_);
local ($c, $cmp, $l, $r, $ret, $return, $test);
@_cmp_lst = sort @_;
@@ -49,21 +60,21 @@ sub Complete {
print $test = substr ($test, $r, $l - $r);
$r = length ($return .= $test);
}
- elsif ($c eq "\004") { # (^D) completion list
+ elsif ($c eq $complete) { # (^D) completion list
print "\r\n";
foreach $cmp (@_cmp_lst) {
print "$cmp\r\n" if $cmp =~ /^$return/;
}
redo loop;
}
- elsif ($c eq "\025" && $r) { # (^U) kill
+ elsif ($c eq $kill && $r) { # (^U) kill
$return = '';
$r = 0;
print "\r\n";
redo loop;
}
# (DEL) || (BS) erase
- elsif ($c eq "\177" || $c eq "\010") {
+ elsif ($c eq $erase1 || $c eq $erase2) {
if($r) {
print "\b \b";
chop ($return);