From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: text/plain; format=flowed; charset=us-ascii From: Jonathan Sergent To: 9fans@cse.psu.edu Mime-Version: 1.0 (Apple Message framework v388) In-Reply-To: <20010612094321.76E9A19A06@mail.cse.psu.edu> Subject: Re: [9fans] help, i'm in a wet paper bag and I can't get out Content-Transfer-Encoding: 7bit Message-Id: <20010612162618.EYIR1645.femail2.sdc1.sfba.home.com@moe> Date: Tue, 12 Jun 2001 09:26:17 -0700 Topicbox-Message-UUID: b69d9ac6-eac9-11e9-9e20-41e7f4b1d025 On Tuesday, June 12, 2001, at 02:51 AM, rog@vitanuova.com wrote: > only problem is that's not very efficient, and possibly wrong (for > packet oriented connections, such as UDP), as it can only read one > character at a time... Yes, that was bugging me too. But what else can you do if you might end up in a subprocess? You end up with magic to seek the file descriptor backwards to cover up the fact that you read too much, and turning off buffering on file descriptors where seek doesn't work. > that buffering problem was the reason i implemented a getlines > primitive in the inferno std module which defines its own loop: > > getlines { > echo line: $line > } < filename That seems kind of awkward. You might not want to do your reads in a loop; you might want to do them in multiple places; perhaps inside a function. > still, i'm not sure that shell scripts are the right place to be > implementing network protocols (although i can't say i'm entirely > innocent). I've done HTTP, FTP, and RTSP in ksh-88... oh, well.