Xref: utzoo comp.unix.questions:6618 comp.unix.wizards:7846 Path: utzoo!mnetor!uunet!steinmetz!vdsvax!barnett From: barnett@vdsvax.steinmetz.ge.com (Bruce G. Barnett) Newsgroups: comp.unix.questions,comp.unix.wizards Subject: Re: telnet i/o redirection? Message-ID: <4216@vdsvax.steinmetz.ge.com> Date: 18 Apr 88 12:07:59 GMT References: <4822@umn-cs.cs.umn.edu> <443@ncifcrf.ncifcrf.gov> Reply-To: barnett@steinmetz.ge.com (Bruce G. Barnett) Followup-To: comp.unix.questions Organization: General Electric CRD, Schenectady, NY Lines: 30 In article <443@ncifcrf.ncifcrf.gov> randy@ncifcrf.gov (The Computer Grue) writes: [ telnet with a script] |This means that you need to send | to end lines instead of , which is the normal unix end of |line character. Don't forget the Login: and Password: lines. These are not terminated by or . I hacked together a simple program for a remote telnet script. (Our Internet gateway doesn't do IP forwarding and isn't BSD based.) I am not satified I did it the most efficient way. I forked a telnet process and connected to it using pipes. I then used fcntl to add the FNDELAY flag. I experimented with different values to distinguish from a timeout and a line without a . I wrote my own buffering scheme. Anyhow, the program works - more-or-less, but I can't help wondering is there is a better way. Anyone have any suggestions? I plan to study the sources of telnet and rlogin - for inspiration. Sigh ... it is amazing how a simple 2-hour hack grows in size to fill all available time. -- Bruce G. Barnett uunet!steinmetz!barnett