+ * Make the temp files.
+ */
+mktemps()
+{
+ register int c, len;
+ int n;
+ char buf[BUFSIZ], *mktemp();
+ FILE *fp;
+
+ (void) sprintf(buf, "%s/.seq", SD);
+ if ((fp = fopen(buf, "r+")) == NULL) {
+ if ((fp = fopen(buf, "w")) == NULL) {
+ printf("%s: cannot create %s\n", name, buf);
+ exit(1);
+ }
+ setbuf(fp, buf);
+ n = 0;
+ } else {
+ setbuf(fp, buf);
+#ifdef BSD41C
+ if (flock(fileno(fp), FEXLOCK)) {
+ printf("%s: cannot lock %s\n", name, buf);
+ exit(1);
+ }
+#endif
+ n = 0;
+ while ((c = getc(fp)) >= '0' && c <= '9')
+ n = n * 10 + (c - '0');
+ }
+ len = strlen(SD) + strlen(host) + 8;
+ tfname = mktemp("tf", n, len);
+ cfname = mktemp("cf", n, len);
+ dfname = mktemp("df", n, len);
+ inchar = strlen(SD) + 3;
+ n = (n + 1) % 1000;
+ (void) fseek(fp, 0L, 0);
+ fprintf(fp, "%d\n", n);
+ (void) fclose(fp);
+}
+
+/*
+ * Make a temp file name.