Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=fwsetup-ng.git;a=commitdiff;h=6ee9968ec52241e8fae7386059ffbf13b98a5200
commit 6ee9968ec52241e8fae7386059ffbf13b98a5200 Author: James Buren <[email protected]> Date: Wed Aug 8 13:06:58 2012 -0500 start over diff --git a/backend.c b/backend.c deleted file mode 100644 index 031a834..0000000 --- a/backend.c +++ /dev/null @@ -1,77 +0,0 @@ -#include <stdlib.h> -#include <stdio.h> -#include <stdbool.h> -#include <stdarg.h> -#include <string.h> -#include <errno.h> -#include "backend.h" - -static FILE *out = 0; -static char *text = 0; -static size_t size = 0; -static bool memory = false; -static long errors = 0; - -extern int backend_set_log_to_file(const char *path) -{ - // Refuse to change output target more than once. - if(out != 0) - { - errno = EINVAL; - - return -1; - } - - out = fopen(path,"wb"); - - if(out == 0) - return -1; - - return 0; -} - -extern int backend_set_log_to_memory(void) -{ - // Refuse to change output target more than once. - if(out != 0) - { - errno = EINVAL; - - return -1; - } - - out = open_memstream(&text,&size); - - if(out == 0) - return -1; - - memory = true; - - return 0; -} - -extern int backend_log(const char *format,...) -{ - va_list args; - int rv = 0; - - if(out == 0 || format == 0) - { - errno = EINVAL; - - return -1; - } - - va_start(args,format); - - if(vfprintf(out,format,args) < 0 || fflush(out) == EOF) - { - ++errors; - - rv = -1; - } - - va_end(args); - - return rv; -} diff --git a/backend.h b/backend.h deleted file mode 100644 index fe09980..0000000 --- a/backend.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -extern int backend_log_to_file(const char *path); -extern int backend_set_log_to_memory(void); -extern int backend_log(const char *format,...) __attribute__((format(printf,1,2))); _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
