some lint, some bug fixes, ^C handling improvements
[unix-history] / usr / src / contrib / ed / edhup.c
index df54a15..b2f40e9 100644 (file)
@@ -9,12 +9,12 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)edhup.c    5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)edhup.c    5.3 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/types.h>
 
 #endif /* not lint */
 
 #include <sys/types.h>
 
-#include <db.h>
+#include <limits.h>
 #include <regex.h>
 #include <setjmp.h>
 #include <stdio.h>
 #include <regex.h>
 #include <setjmp.h>
 #include <stdio.h>
@@ -22,6 +22,10 @@ static char sccsid[] = "@(#)edhup.c  5.2 (Berkeley) %G%";
 #include <string.h>
 #include <unistd.h>
 
 #include <string.h>
 #include <unistd.h>
 
+#ifdef DBI
+#include <db.h>
+#endif
+
 #include "ed.h"
 #include "extern.h"
 
 #include "ed.h"
 #include "extern.h"
 
@@ -39,6 +43,7 @@ do_hup()
        char l_filename[FILENAME_LEN], *l_temp;
        FILE *l_fp;
 
        char l_filename[FILENAME_LEN], *l_temp;
        FILE *l_fp;
 
+       sigspecial++;
        if (change_flag == 0)
                exit(1);                /* No need to save buffer contents. */
        if ((l_fp = fopen("ed.hup", "w")) == NULL) {
        if (change_flag == 0)
                exit(1);                /* No need to save buffer contents. */
        if ((l_fp = fopen("ed.hup", "w")) == NULL) {
@@ -53,7 +58,13 @@ do_hup()
        }
        edwrite(l_fp, top, bottom);
        fclose(l_fp);
        }
        edwrite(l_fp, top, bottom);
        fclose(l_fp);
+#ifdef STDIO
+       fclose(fhtmp);
+       unlink(template);
+#endif
+#ifdef DBI
        (dbhtmp->close) (dbhtmp);
        unlink(template);
        (dbhtmp->close) (dbhtmp);
        unlink(template);
+#endif
        exit(1);                                /* Hangup */
 }
        exit(1);                                /* Hangup */
 }