Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!cornell!uw-beaver!ssc-vax!uvicctr!tholm From: tholm@uvicctr.UUCP (Terrence W. Holm) Newsgroups: comp.os.minix Subject: line(1) Message-ID: <479@uvicctr.UUCP> Date: 26 Aug 88 00:13:11 GMT Reply-To: tholm@uvicctr.UUCP (Terrence W. Holm) Organization: University of Victoria, Victoria B.C. Canada Lines: 60 EFTH MINIX report #35 - August 1988 - line(1) There follows an implementation of line(1) for Minix. Please consider this public domain software. A "man" page is included. ---------------------------------------------------------- echo x - line.1 gres '^X' '' > line.1 << '/' XCOMMANDS X line(1) - read and echo a line X XINVOCATION X line X XEXPLANATION X Line(1) reads one line from standard input and writes it X to standard output. At least a new-line is always output. X XRESULTS X The exit status is 1 on EOF, 0 otherwise. / echo x - line.c gres '^X' '' > line.c << '/' X/* line(1) X * X * Author: Terrence W. Holm Aug. 1988 X */ X X#include X X Xmain() X { X int c; X X setbuf( stdin, NULL ); X X while ( (c = getchar()) != EOF ) X { X putchar( c ); X X if ( c == '\n' ) X exit( 0 ); X } X X putchar( '\n' ); X exit( 1 ); X } / ---------------------------------------------------------- Edwin L. Froese uw-beaver!ubc-cs!mprg!handel!froese Terrence W. Holm uw-beaver!uvicctr!tholm