won't build with newvm system.
[unix-history] / usr / src / old / gets / gets.c
CommitLineData
cc5f3fdf 1static char *sccsid = "@(#)gets.c 4.2 (Berkeley) %G%";
1173af4e
BJ
2#include <stdio.h>
3
4/*
5 * gets [ default ]
6 *
7 * read a line from standard input, echoing to std output
8 * if an error occurs just return "default"
9 * if no default and error exit abnormally
10 */
11main(argc, argv)
12 int argc;
13 char *argv[];
14{
15 char buf[BUFSIZ];
16
cc5f3fdf 17 setbuf(stdin, NULL);
1173af4e
BJ
18 if (gets(buf) == NULL || buf[0] < ' ') {
19 if (argc == 1)
20 exit(1);
21 strcpy(buf,argv[1]);
22 }
23 printf("%s\n", buf);
24 exit(0);
25}