2 * UCW Library -- Temporary Fastbufs
4 * (c) 2002--2004 Martin Mares <mj@ucw.cz>
6 * This software may be freely distributed and used according to the terms
7 * of the GNU Lesser General Public License.
12 #include "lib/fastbuf.h"
15 #include <sys/fcntl.h>
17 static byte *temp_template = "/tmp/temp%d.%d";
19 static struct cf_section temp_config = {
21 CF_STRING("Template", &temp_template),
26 static void CONSTRUCTOR temp_init_config(void)
28 cf_declare_section("Tempfiles", &temp_config, 0);
36 static uns temp_counter;
38 sprintf(buf, temp_template, (int) getpid(), temp_counter++);
39 f = bopen(buf, O_RDWR | O_CREAT | O_TRUNC, buflen);
40 bconfig(f, BCONFIG_IS_TEMP_FILE, 1);