|
|
1.1 root 1: #include <stdio.h>
2:
3: /*
4: * gets [ default ]
5: *
6: * read a line from standard input, echoing to std output
7: * if an error occurs just return "default"
8: * if no default and error exit abnormally
9: */
10: main(argc, argv)
11: int argc;
12: char *argv[];
13: {
14: char buf[BUFSIZ];
15:
16: if (gets(buf) == NULL || buf[0] < ' ') {
17: if (argc == 1)
18: exit(1);
19: strcpy(buf,argv[1]);
20: }
21: printf("%s\n", buf);
22: exit(0);
23: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.