X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Ffb-temp.c;h=62c6e3820f963a9434365e18ee87508707207e65;hb=e23b57dd8b0ac4da53451625be99ca1fa75caa48;hp=650e8a091d45c34c87c4a69b4b3109793de33cc3;hpb=49ed04e2e93a6a5b01058638224621d5c07db01c;p=libucw.git diff --git a/lib/fb-temp.c b/lib/fb-temp.c index 650e8a09..62c6e382 100644 --- a/lib/fb-temp.c +++ b/lib/fb-temp.c @@ -1,14 +1,14 @@ /* - * Sherlock Library -- Temporary Fastbufs + * UCW Library -- Temporary Fastbufs * - * (c) 2002 Martin Mares + * (c) 2002--2004 Martin Mares * * This software may be freely distributed and used according to the terms * of the GNU Lesser General Public License. */ #include "lib/lib.h" -#include "lib/conf.h" +#include "lib/conf2.h" #include "lib/fastbuf.h" #include @@ -16,26 +16,27 @@ static byte *temp_template = "/tmp/temp%d.%d"; -static struct cfitem temp_config[] = { - { "Tempfiles", CT_SECTION, NULL }, - { "Template", CT_STRING, &temp_template }, - { NULL, CT_STOP, NULL } +static struct cf_section temp_config = { + CF_ITEMS { + CF_STRING("Template", &temp_template), + CF_END + } }; static void CONSTRUCTOR temp_init_config(void) { - cf_register(temp_config); + cf_declare_section("Tempfiles", &temp_config, 0); } struct fastbuf * -bopen_tmp(uns bufsize) +bopen_tmp(uns buflen) { byte buf[256]; struct fastbuf *f; static uns temp_counter; sprintf(buf, temp_template, (int) getpid(), temp_counter++); - f = bopen(buf, O_RDWR | O_CREAT | O_EXCL, bufsize); - f->is_temp_file = 1; + f = bopen(buf, O_RDWR | O_CREAT | O_TRUNC, buflen); + bconfig(f, BCONFIG_IS_TEMP_FILE, 1); return f; }