- (*db->close)(db);
-
- if (c < 0)
- perror(fname);
- if ( ! jobwait(pid))
- c = -1;
-
- return(1 == c ? 1 : -1);
-}
-
-/*
- * Copy both recno and btree databases into the destination.
- * Call in to begin recreating HTML files.
- * Return -1 on fatal error and 1 if the update went well.
- */
-static int
-update(char *dst, char *src)
-{
- size_t dsz, ssz;
-
- dsz = strlen(dst);
- ssz = strlen(src);
-
- xstrlcat(src, "/mandoc.db", MAXPATHLEN);
- xstrlcat(dst, "/mandoc.db", MAXPATHLEN);
-
- if ( ! filecpy(dst, src))
- return(-1);
- if (verbose)
- printf("%s\n", dst);
-
- dst[(int)dsz] = src[(int)ssz] = '\0';
-
- xstrlcat(src, "/mandoc.index", MAXPATHLEN);
- xstrlcat(dst, "/mandoc.index", MAXPATHLEN);
-
- if ( ! filecpy(dst, src))
- return(-1);
- if (verbose)
- printf("%s\n", dst);
-
- dst[(int)dsz] = '\0';
-
- return(indexhtml(dst));
-}
-
-/*
- * See if btree or recno databases in the destination are out of date
- * with respect to a single manpath component.
- * Return -1 on fatal error, 0 if the source is no longer valid (and
- * shouldn't be listed), and 1 if the update went well.
- */
-static int
-treecpy(char *dst, char *src)
-{
- size_t dsz, ssz;
- int rc;
-
- dsz = strlen(dst);
- ssz = strlen(src);
-
- xstrlcat(src, "/mandoc.index", MAXPATHLEN);
- xstrlcat(dst, "/mandoc.index", MAXPATHLEN);
-
- if (-1 == (rc = isnewer(dst, src)))
- return(0);
-
- dst[(int)dsz] = src[(int)ssz] = '\0';
-
- if (1 == rc)
- return(update(dst, src));
-
- xstrlcat(src, "/mandoc.db", MAXPATHLEN);
- xstrlcat(dst, "/mandoc.db", MAXPATHLEN);
-
- if (-1 == (rc = isnewer(dst, src)))
- return(0);
- else if (rc == 0)
- return(1);
-
- dst[(int)dsz] = src[(int)ssz] = '\0';
-
- return(update(dst, src));