in reply to Re^2: Parsing /etc/remote
in thread Parsing /etc/remote

Although it doesn't seem to be required by the file format in the examples and man pages I've looked at, if the end of the alias line is terminated with a colon it will work as expected.

Replies are listed 'Best First'.
Re^4: Parsing /etc/remote
by gri6507 (Deacon) on Nov 29, 2005 at 16:00 UTC
    Unfortunately, the customers' /etc/remote will be as I have outlined above - without a colon. However, after reading the documentation, it seems that I should be able to set the TERMCAP environment variable to account for that, but I cannot seem to figure out how (Correction - to what. Any suggestions?
      $ENV{TERMCAP} = "something"; sets the the TERMCAP environment variable, but I'm guessing you're asking *what* to set it to.

      Update:

      Nasty kludge?

      use strict; use warnings; use Term::Cap; my $PortName = 'MyPort'; if (scalar(@ARGV)) { $PortName = $ARGV[0]; } my $remote = "/etc/remote"; my $tmp_rem = "/tmp/remote.$$"; open (REMOTE, $remote) || die "Can't read '$remote': $!\n"; open (TMPREM, "> $tmp_rem") || die "Can't write to: '$tmp_rem': $!\n"; while(<REMOTE>) { s/$/:/ if /tc=[^:]+$/; print TMPREM; } close(TMPREM); close(REMOTE); $ENV{TERMPATH} = $tmp_rem; my $terminal = Tgetent Term::Cap { TERM => $PortName, OSPEED => 9600}; print $terminal->Tgoto('dv', "", "",), $/; unlink($tmp_rem);