1 warn "Legacy library @{[(caller(0))[6]]} will be removed from the Perl core distribution in the next major release. Please install it from the CPAN distribution Perl4::CoreLibs. It is being used at @{[(caller)[1]]}, line @{[(caller)[2]]}.\n";
5 # This library is no longer being maintained, and is included for backward
6 # compatibility with Perl 4 programs which may require it.
7 # This legacy library is deprecated and will be removed in a future
10 # In particular, this should not be used as an example of modern Perl
11 # programming techniques.
13 # Suggested alternative: Term::Complete
15 ;# @(#)complete.pl,v1.1 (me@anywhere.EBay.Sun.COM) 09/23/91
17 ;# Author: Wayne Thompson
20 ;# This routine provides word completion.
21 ;# (TAB) attempts word completion.
22 ;# (^D) prints completion list.
23 ;# (These may be changed by setting $Complete'complete, etc.)
26 ;# Bell when word completion fails.
29 ;# The tty driver is put into raw mode.
34 ;# $input = &Complete('prompt_string', *completion_list);
36 ;# $input = &Complete('prompt_string', @completion_list);
51 local($prompt, @cmp_list, $return, @match, $l, $test, $cmp, $r);
52 if ($_[1] =~ /^StB\0/) {
60 system('stty raw -echo');
62 print($prompt, $return);
63 while (($_ = getc(STDIN)) ne "\r") {
65 # (TAB) attempt completion
67 @match = grep(/^$return/, @cmp_lst);
68 $l = length($test = shift(@match));
69 unless ($#match < 0) {
70 foreach $cmp (@match) {
71 until (substr($cmp, 0, $l) eq substr($test, 0, $l)) {
77 print($test = substr($test, $r, $l - $r));
78 $r = length($return .= $test);
82 # (^D) completion list
83 $_ eq $complete && do {
84 print(join("\r\n", '', grep(/^$return/, @cmp_lst)), "\r\n");
100 ($_ eq $erase1 || $_ eq $erase2) && do {
119 system('stty -raw echo');