home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / perl / 5780 < prev    next >
Encoding:
Internet Message Format  |  1992-09-08  |  3.4 KB

  1. Path: sparky!uunet!cs.utexas.edu!sun-barr!olivea!spool.mu.edu!sdd.hp.com!ux1.cso.uiuc.edu!bradley.bradley.edu!pwh
  2. From: pwh@bradley.bradley.edu (Pete Hartman)
  3. Newsgroups: comp.lang.perl
  4. Subject: termcap update via perl oddity
  5. Message-ID: <1992Sep8.211620.13578@bradley.bradley.edu>
  6. Date: 8 Sep 92 21:16:20 GMT
  7. Distribution: usa
  8. Organization: Bradley University
  9. Lines: 73
  10.  
  11.  
  12. I have the following perl script which I run with perl 4.0.1.6
  13. to update the "top" section of our termcap file with local additions.
  14.  
  15. #!/usr/local/bin/perl
  16. #
  17. # perl script to install a new termcap file
  18. #
  19. #    basically this takes the easy way out.  copy the entirety of
  20. #    bradley local termcaps into the top of the termcap file, replacing
  21. #    the previous values for ALL local termcaps.
  22.  
  23. $capfile = '/etc/termcap';
  24. $install = '/src/local/TERMCAPS/termcap';
  25.  
  26. open(TERMCAP,$capfile);
  27. open(INSTALL,$install);
  28. @termcap=<TERMCAP>;
  29. @install=<INSTALL>;
  30. close(TERMCAP);
  31. close(INSTALL);
  32.  
  33. $i=0;
  34. while (!($termcap[$i] =~ /^# -----/)) {
  35.     $i++;
  36. }
  37. @newcap = (@install, @termcap[($i+1)..$#termcap]);
  38.  
  39. open(TERMCAP,">$capfile");
  40. print TERMCAP @newcap;
  41. close(TERMCAP);
  42.  
  43.  
  44. The last time I ran it, apparently it choked on the following termcap
  45. entry, which is one of the "standard" entries, i.e. it's not one
  46. of our local ones in the "top" of the file.
  47.  
  48. # AED 512
  49. # by giles Billingsley (gilesb%ucbcad@berkeley)
  50. # rewritten 8/82 for newer AEDs and better operation of vi,etc.
  51. MS|aed|AED|aed512|AED512|aed 512:\
  52.     :db:co#64:li#40:cl=^L:bs:nd=\Ei0800\001:\
  53.     :up=^K:ve=\E\E\E\E\E\E\E\072004=000200??\001:\
  54.     :vb=\EK0001??0000K0001202080\001:\
  55.     :us=\E\07200>8000140\001:ue=\E\07200>8000100\001:\
  56.     :uc=\Ei???>l0800i0102\001:\
  57.     :ti=\E\07200>8000140{<04<0??00001010L<0\072004=0002??00\001:\
  58.     :te=\E\07200>8000100{804<0??00001000L80\072004=000200??\001:\
  59.     :so=\E\07200>8000140[80C00\001:se=\E[00C80\001:\
  60.     :is=\EG1MMM.`40K0001202080K8001????00^L\EC80L80{80^L\EK010100????K0601??0000c818100\EG1HHH.\07210000019A27FD006A280D002A200A52429FE8524861086118612861360N031B4C3F3F1800N041B0C1B4C38301800N001B3B313030301800N011B3B313030341800N021B3B313030381800N050800N061B3B313335301800\07211000015A58E8D5011A58F8D5111A5908D5211A5918D531160\07212000015AD5011858EAD5111858FAD52118590AD5311859160\0721300004B2071C5858E0A18658E0A0A858EA900858F268FA5278590A50A29018591A9F51865908590A90165918591A59038E58E8590A591E58F290185912071C5
  61.  
  62.  
  63. 180A0A0A0901858EA900858F268F60\0721350000BA9472031DEA9502031DE60\E\E\E\EG1MMM.^A:
  64. zL|aed-ucb|AED-UCB|aed512-ucb|AED512-UCB|aed 512 w/o UCB ROM:\
  65.     :db:co#64:li#40:cl=^L:bs:nd=\Ei0800\001:up=^K:\
  66.     :ve=\E\E\E\E\E\E\E\072004=000200??\001:\
  67.     :vb=\EK0001??0000K0001202080\001:\
  68.     :us=\E\07200>8000140\001:ue=\E\07200>8000100\001:\
  69.     :uc=\Ei???>l0800i0102\001:\
  70.     :ti=\E\07200>8000140{<04<0??00001010L<0\072004=0002??00\001:\
  71.     :te=\E\07200>8000100{804<0??00001000L80\072004=000200??\001:\
  72.     :so=\E\07200>8000140[80C00\001:se=\E[00C80\001:\
  73.     :if=/usr/share/lib/tabset/aed512:
  74.  
  75.  
  76. After running the script, unknown to me until a user complained about
  77. a missing termcap, everything from and including the extremely long line
  78. was truncated.  Is there something stupid in my script that causes
  79. it to choke on this?  I thought it was pretty simple to just read it
  80. in as the file existed, replace the top of it, and write it back out
  81. again, without line length limits.
  82. -- 
  83. Pete Hartman               Bradley University    pwh@bradley.bradley.edu
  84.              If we do not succeed, then we run the risk of failure
  85.