BSD 4_4 release
[unix-history] / usr / src / old / refer / addbib / addbib.c
index ca37cc9..667e7d0 100644 (file)
@@ -1,6 +1,12 @@
+/*-
+ * This module is believed to contain source code proprietary to AT&T.
+ * Use and redistribution is subject to the Berkeley Software License
+ * Agreement and your Software Agreement with AT&T (Western Electric).
+ */
+
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)addbib.c    4.1 (Berkeley) %G%";
-#endif
+static char sccsid[] = "@(#)addbib.c   4.3 (Berkeley) 4/18/91";
+#endif /* not lint */
 
 #include <stdio.h>
 #include <ctype.h>
 
 #include <stdio.h>
 #include <ctype.h>
@@ -103,7 +109,11 @@ char *argv;
                for (i = 0; i < entries; i++)
                {
                        printf("%s\t", bibskel[i].prompt);
                for (i = 0; i < entries; i++)
                {
                        printf("%s\t", bibskel[i].prompt);
-                       fgets(line, BUFSIZ, stdin);
+                       if (fgets(line, BUFSIZ, stdin) == NULL)
+                       {
+                               clearerr(stdin);
+                               break;
+                       }
                        if (line[0] == '-' && line[1] == '\n')
                        {
                                i -= 2;
                        if (line[0] == '-' && line[1] == '\n')
                        {
                                i -= 2;
@@ -158,6 +168,7 @@ char *argv;
                                }
                                fputs(line, fp);
                        }
                                }
                                fputs(line, fp);
                        }
+                       clearerr(stdin);
                }
                fflush(fp);     /* write to file at end of each cycle */
                if (ferror(fp))
                }
                fflush(fp);     /* write to file at end of each cycle */
                if (ferror(fp))