From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from news.lsuc.on.ca ([142.57.1.101]) by archone.tamu.edu with SMTP id <18983>; Wed, 11 Dec 1991 06:37:54 -0600 Received: by news.lsuc.on.ca (/\==/\ Smail3.1.24.1 #24.4) id ; Wed, 11 Dec 91 07:38 EST Received: by golem.uucp (/\==/\ Smail3.1.24.1 #24.13) id ; Wed, 11 Dec 1991 07:28 -0500 To: dws@cs.wisc.edu (DaviD W. Sanderson) cc: The rc user community Subject: Re: A lighter read function In-reply-to: Your message of "Tue, 10 Dec 91 23:32:36 EST." <9112110432.AA18495@skinner.cs.wisc.edu> Date: Wed, 11 Dec 1991 06:28:26 -0600 Message-ID: <22832.692454506@golem.UUCP> From: "David J. Fiander" >> exactly the same functionality as the example source, except it >> uses line(1) and doesn't do the assignment if the read fails. > >line(1) is not available everywhere. At least not on the 4.3BSD-utah >systems I use. Perhaps rephrasing in terms of `sed 1q' would be better. Try 'david%golem@lsuc.on.ca'. True, but the problem with sed is that it doesn't fail on EOF, which is true of line. line is available on all SCO UNIX systems, and I first saw it on a BSD 4.2 system (I think). Besides it is easily written: #include main(argc, argv) int argc; char **argv; { char buf[256]; int len; if (fgets(buf, sizeof(buf), stdin) == (char *)NULL) { fputs(buf, stdout); exit(0); } else exit(1); }