diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2023-11-06 08:20:52 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2023-11-06 08:20:52 +0000 |
commit | 6a514c0f6c89a16c7993b35fa23f11c33c1a1e72 (patch) | |
tree | 1959dd835c5666bcd6bae5d4f4da6cd9c753bfad /gnu/usr.bin | |
parent | 0d543669acc06b046599b9ca34972d90fbc4278e (diff) |
since we're always running info_cmp in the end, remove the whole
"in case of emergency run info_cmp block" (more efficient: we only
parse the entry we need). Keep the small part that creates a dumb terminal
on VMS, even though we're not running that.
Add an extra state check in the automaton to avoid skipping a tmp_term
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r-- | gnu/usr.bin/perl/cpan/Term-Cap/Cap.pm | 52 |
1 files changed, 12 insertions, 40 deletions
diff --git a/gnu/usr.bin/perl/cpan/Term-Cap/Cap.pm b/gnu/usr.bin/perl/cpan/Term-Cap/Cap.pm index 7608998d61a..c814a7196c1 100644 --- a/gnu/usr.bin/perl/cpan/Term-Cap/Cap.pm +++ b/gnu/usr.bin/perl/cpan/Term-Cap/Cap.pm @@ -232,45 +232,6 @@ sub Tgetent my @termcap_path = termcap_path(); - if ( !@termcap_path && !$entry ) - { - - # last resort--fake up a termcap from terminfo - local $ENV{TERM} = $term; - - if ( $^O eq 'VMS' ) - { - $entry = $VMS_TERMCAP; - } - else - { - if ( grep { -x "$_/infocmp" } split /:/, $ENV{PATH} ) - { - eval { - my $tmp = `infocmp -C 2>/dev/null`; - $tmp =~ s/^#.*\n//gm; # remove comments - if ( ( $tmp !~ m%^/%s ) - && ( $tmp =~ /(^|\|)\Q$tmp_term\E[:|]/s ) ) - { - $entry = $tmp; - $seen->{$tmp_term} = 1; - } - }; - warn "Can't run infocmp to get a termcap entry: $@" if $@; - } - else - { - # this is getting desperate now - if ( $self->{TERM} eq 'dumb' ) - { - $entry = 'dumb|80-column dumb tty::am::co#80::bl=^G:cr=^M:do=^J:sf=^J:'; - } - } - } - } - - croak "Can't find a valid termcap file" unless @termcap_path || $entry; - $state = 1; # 0 == finished # 1 == next file # 2 == search again @@ -343,6 +304,8 @@ sub Tgetent close $fh; waitpid($child, 0) if defined $child; + next if $state != 0; + # If :tc=...: found then search this file again while ($entry =~ s/:tc=([^:]+):/:/) { $tmp_term = $1; @@ -352,7 +315,16 @@ sub Tgetent } } - croak "Can't find $term" if $entry eq ''; + if ( !defined $entry ) { + if ( $^O eq 'VMS' ) { + $entry = $VMS_TERMCAP; + # this is getting desperate now + } elsif ( $self->{TERM} eq 'dumb' ){ + $entry = 'dumb|80-column dumb tty::am::co#80::bl=^G:cr=^M:do=^J:sf=^J:'; + } + } + + croak "Can't find $term" if !defined $entry; $entry =~ s/:+\s*:+/:/g; # cleanup $entry $entry =~ s/:+/:/g; # cleanup $entry $self->{TERMCAP} = $entry; # save it |