fix alias bug; count message sizes; map stderr->stdout; misc.
[unix-history] / usr / src / old / gets / gets.c
CommitLineData
1173af4e
BJ
1static char *sccsid = "@(#)gets.c 4.1 (Berkeley) %G%";
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
17 if (gets(buf) == NULL || buf[0] < ' ') {
18 if (argc == 1)
19 exit(1);
20 strcpy(buf,argv[1]);
21 }
22 printf("%s\n", buf);
23 exit(0);
24}