+ return(TRUE);
+}
+/*
+ * return 1 if the tmpfile can be removed after writing it out
+ */
+int mustoverwrite(preciousfile, tmpfile)
+ FILE *preciousfile;
+ FILE *tmpfile;
+{
+ int nread;
+
+ while((nread = fread(edbuf, 1, sizeof(edbuf), tmpfile)) != NULL){
+ if (mustwrite(edbuf, nread, preciousfile) == 0)
+ return(0);
+ }
+ return(1);
+}
+/*
+ * return 0 on catastrophe
+ */
+mustwrite(base, n, preciousfile)
+ char *base;
+ int n;
+ FILE *preciousfile;
+{
+ int nwrote;
+
+ if (n <= 0)
+ return(1);
+ nwrote = fwrite(base, 1, n, preciousfile);
+ if (nwrote == n)
+ return(1);
+ perror(processname);
+ switch(inquire(terse
+ ? "Botch overwriting: retry? "
+ : "Botch overwriting the source file: retry? ")){
+ case Q_YES:
+ case Q_yes:
+ mustwrite(base + nwrote, n - nwrote, preciousfile);
+ return(1);
+ case Q_NO:
+ case Q_no:
+ switch(inquire("Are you sure? ")){
+ case Q_YES:
+ case Q_yes:
+ return(0);
+ case Q_NO:
+ case Q_no:
+ mustwrite(base + nwrote, n - nwrote, preciousfile);
+ return(1);
+ }
+ default:
+ return(0);
+ }