Annotation of 40BSD/cmd/gets.c, revision 1.1.1.1

1.1       root        1: static char *sccsid = "@(#)gets.c      4.1 (Berkeley) 10/1/80";
                      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:  */
                     11: main(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: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.