home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / perl / 5606 < prev    next >
Encoding:
Internet Message Format  |  1992-08-30  |  1.3 KB

  1. Path: sparky!uunet!ferkel.ucsb.edu!taco!rock!concert!rutgers!cs.utexas.edu!news
  2. From: meyering@cs.utexas.edu (Jim Meyering)
  3. Newsgroups: comp.lang.perl
  4. Subject: portability of chat2.pl from 4.035
  5. Message-ID: <l9vvvtINNm38@ai.cs.utexas.edu>
  6. Date: 29 Aug 92 22:53:49 GMT
  7. Organization: U of TX at Austin CS Dept
  8. Lines: 28
  9. NNTP-Posting-Host: ai.cs.utexas.edu
  10.  
  11. I've been experimenting with chat2.pl from perl-4.035 and came
  12. across a minor portability glitch.  chat2 has this header:
  13.  
  14.     ## chat.pl: chat with a server
  15.     ## V2.01.alpha.7 91/06/16
  16.     ## Randal L. Schwartz
  17.  
  18. The problem is that it assumes stty sets characteristics of its
  19. standard output.  On some systems (e.g. some system V and POSIX)
  20. stty sets characteristics of the input tty.
  21.  
  22. Here's a patch that worked for me (using the POSIX-compliant stty
  23. from GNU shellutils-1.7 on a Sun4 running SunOS 4.1.1).
  24.  
  25. --- chat2.pl.~1~    Sat Aug 29 17:40:12 1992
  26. +++ chat2.pl    Sat Aug 29 17:39:58 1992
  27. @@ -323,7 +323,7 @@
  28.              ($tty = $pty) =~ s/pty/tty/;
  29.              open($_TTY,"+>$tty") || next;
  30.              select((select($_TTY), $| = 1)[0]);
  31. -            system "stty nl>$tty";
  32. +            system "stty nl<$tty >$tty";
  33.              return ($pty,$tty);
  34.          }
  35.      }
  36. -- 
  37. Jim Meyering             | Member of the League for Programming Freedom
  38. meyering@cs.utexas.edu   | Contact me or league@prep.ai.mit.edu for more info.
  39.