From: pwh@bradley.bradley.edu (Pete Hartman)
Newsgroups: comp.lang.perl
Subject: termcap update via perl oddity
Date: 8 Sep 92 21:16:20 GMT
Distribution: usa
Organization: Bradley University


I have the following perl script which I run with perl 4.0.1.6
to update the "top" section of our termcap file with local additions.

#!/usr/local/bin/perl
#
# perl script to install a new termcap file
#
#	basically this takes the easy way out.  copy the entirety of
#	bradley local termcaps into the top of the termcap file, replacing
#	the previous values for ALL local termcaps.

$capfile = '/etc/termcap';
$install = '/src/local/TERMCAPS/termcap';

open(TERMCAP,$capfile);
open(INSTALL,$install);
@termcap=<TERMCAP>;
@install=<INSTALL>;
close(TERMCAP);
close(INSTALL);

$i=0;
while (!($termcap[$i] =~ /^# -----/)) {
	$i++;
}
@newcap = (@install, @termcap[($i+1)..$#termcap]);

open(TERMCAP,">$capfile");
print TERMCAP @newcap;
close(TERMCAP);


The last time I ran it, apparently it choked on the following termcap
entry, which is one of the "standard" entries, i.e. it's not one
of our local ones in the "top" of the file.

# AED 512
# by giles Billingsley (gilesb%ucbcad@berkeley)
# rewritten 8/82 for newer AEDs and better operation of vi,etc.
MS|aed|AED|aed512|AED512|aed 512:\
	:db:co#64:li#40:cl=^L:bs:nd=\Ei0800\001:\
	:up=^K:ve=\E\E\E\E\E\E\E\072004=000200??\001:\
	:vb=\EK0001??0000K0001202080\001:\
	:us=\E\07200>8000140\001:ue=\E\07200>8000100\001:\
	:uc=\Ei???>l0800i0102\001:\
	:ti=\E\07200>8000140{<04<0??00001010L<0\072004=0002??00\001:\
	:te=\E\07200>8000100{804<0??00001000L80\072004=000200??\001:\
	:so=\E\07200>8000140[80C00\001:se=\E[00C80\001:\
	:is=\EG1MMM.`40K0001202080K8001????00^L\EC80L80{80^L\EK010100????K0601??0000c818100\EG1HHH.\07210000019A27FD006A280D002A200A52429FE8524861086118612861360N031B4C3F3F1800N041B0C1B4C38301800N001B3B313030301800N011B3B313030341800N021B3B313030381800N050800N061B3B313335301800\07211000015A58E8D5011A58F8D5111A5908D5211A5918D531160\07212000015AD5011858EAD5111858FAD52118590AD5311859160\0721300004B2071C5858E0A18658E0A0A858EA900858F268FA5278590A50A29018591A9F51865908590A90165918591A59038E58E8590A591E58F290185912071C5


180A0A0A0901858EA900858F268F60\0721350000BA9472031DEA9502031DE60\E\E\E\EG1MMM.^A:
zL|aed-ucb|AED-UCB|aed512-ucb|AED512-UCB|aed 512 w/o UCB ROM:\
	:db:co#64:li#40:cl=^L:bs:nd=\Ei0800\001:up=^K:\
	:ve=\E\E\E\E\E\E\E\072004=000200??\001:\
	:vb=\EK0001??0000K0001202080\001:\
	:us=\E\07200>8000140\001:ue=\E\07200>8000100\001:\
	:uc=\Ei???>l0800i0102\001:\
	:ti=\E\07200>8000140{<04<0??00001010L<0\072004=0002??00\001:\
	:te=\E\07200>8000100{804<0??00001000L80\072004=000200??\001:\
	:so=\E\07200>8000140[80C00\001:se=\E[00C80\001:\
	:if=/usr/share/lib/tabset/aed512:


After running the script, unknown to me until a user complained about
a missing termcap, everything from and including the extremely long line
was truncated.  Is there something stupid in my script that causes
it to choke on this?  I thought it was pretty simple to just read it
in as the file existed, replace the top of it, and write it back out
again, without line length limits.
-- 
Pete Hartman		       Bradley University	pwh@bradley.bradley.edu
             If we do not succeed, then we run the risk of failure
Xref: sparky comp.lang.perl:5779 comp.lang.postscript:4628 comp.compression:3225