home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
minnie.tuhs.org
/
unixen.tar
/
unixen
/
PDP-11
/
Distributions
/
ucb
/
spencer_2bsd.tar.gz
/
2bsd.tar
/
src
/
gets.c
< prev
next >
Wrap
C/C++ Source or Header
|
1980-02-17
|
454b
|
26 lines
/* Copyright (c) 1979 Regents of the University of California */
#include <retrofit.h>
#include <stdio.h>
/*
* gets [ default ]
*
* read a line from standard input, echoing to std output
* if an error occurs just return "default"
* if no default and error exit abnormally
*/
main(argc, argv)
int argc;
char *argv[];
{
char buf[BUFSIZ];
if (gets(buf) == NULL) {
if (argc == 1)
exit(1);
buf[0] = 0;
}
printf("%s\n", buf);
exit(0);
}