to fastbuf.c anyway).
SHLIB_OBJS=alloc.o alloc_str.o ctmatch.o db.o fastbuf.o fb-file.o fb-mem.o lists.o \
log.o log2.o md5.o md5hex.o mmap.o pagecache.o patimatch.o patmatch.o pool.o \
- prime.o random.o realloc.o regex.o temp.o timer.o url.o wildmatch.o \
+ prime.o random.o realloc.o regex.o timer.o url.o wildmatch.o \
wordsplit.o str_ctype.o str_upper.o bucket.o conf.o object.o sorter.o \
finger.o proctitle.o
#define ABS(x) ((x) < 0 ? -(x) : (x))
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(*(a)))
-/* Temporary Files */
-
-#define TMP_DIR "tmp"
-#define TMP_DIR_LEN 3
-
-struct tempfile {
- int fh;
- byte name[32];
-};
-
-void open_temp(struct tempfile *, byte *);
-void delete_temp(struct tempfile *);
-u32 temprand(uns);
-
/* Logging */
#define L_DEBUG 'D' /* Debugging messages */
+++ /dev/null
-/*
- * Sherlock Library -- Temporary Files
- *
- * (c) 1997 Martin Mares <mj@ucw.cz>
- */
-
-#include "lib/lib.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-u32
-temprand(uns key)
-{
- static int seeded = 0;
- u32 rand;
-
- if (!seeded)
- {
- seeded = 1;
- srand(getpid());
- }
- rand = random() << 1;
- rand += key * 0xdeadbeef;
- return rand;
-}
-
-void
-open_temp(struct tempfile *tf, byte *tftype)
-{
- int retry = 50;
- while (retry--)
- {
- sprintf(tf->name, TMP_DIR "/%s%08x", tftype, temprand(retry));
- tf->fh = open(tf->name, O_RDWR | O_CREAT | O_EXCL, 0666);
- if (tf->fh >= 0)
- return;
- }
- die("Unable to create temporary file");
-}
-
-void
-delete_temp(struct tempfile *tf)
-{
- close(tf->fh);
- unlink(tf->name);
-}