[comp.os.minix] line

tholm@uvicctr.UUCP (Terrence W. Holm) (08/26/88)

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 <stdio.h>
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