1: #ifndef lint
   2: static char *sccsid = "@(#)gets.c	4.2 (Berkeley) 6/19/81";
   3: #endif
   4: #include <stdio.h>
   5: 
   6: /*
   7:  * gets [ default ]
   8:  *
   9:  *      read a line from standard input, echoing to std output
  10:  *      if an error occurs just return "default"
  11:  *      if no default and error exit abnormally
  12:  */
  13: main(argc, argv)
  14:     int argc;
  15:     char *argv[];
  16: {
  17:     char buf[BUFSIZ];
  18: 
  19:     setbuf(stdin, NULL);
  20:     if (gets(buf) == NULL || buf[0] < ' ') {
  21:         if (argc == 1)
  22:             exit(1);
  23:         strcpy(buf,argv[1]);
  24:     }
  25:     printf("%s\n", buf);
  26:     exit(0);
  27: }

Defined functions

main defined in line 13; never used

Defined variables

sccsid defined in line 2; never used
Last modified: 1982-09-04
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 601
Valid CSS Valid XHTML 1.0 Strict