From 9a5915a2148aa9fd89d4a3b19d5c4f02d45f14a3 Mon Sep 17 00:00:00 2001 From: marschap Date: Sat, 30 Sep 2006 20:35:13 +0000 Subject: [PATCH] remove unused files --- shared/fileio.c | 83 ------------------------------------------------- shared/fileio.h | 40 ------------------------ 2 files changed, 123 deletions(-) delete mode 100644 shared/fileio.c delete mode 100644 shared/fileio.h diff --git a/shared/fileio.c b/shared/fileio.c deleted file mode 100644 index 4742ee5..0000000 --- a/shared/fileio.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * fileio.c - * This file is part of LCDd, the lcdproc server. - * - * This file is released under the GNU General Public License. Refer to the - * COPYING file distributed with this package. - * - * Copyright (c) 2003, Rene Wagner - * - * - * Defines routines to read from buffered files. - * - */ - -#include -#include -#include "fileio.h" - -#define FILECHUNKSIZE 10 - -buffile *buffile_open( const char *path, const char *mode ) { - buffile * file = NULL; - - file = malloc(sizeof(*file)); - if ( NULL == file ) - return NULL; - - file->pos=0; - file->bytesread=0; - file->buf=NULL; - - file->f = fopen( path, mode ); - if( NULL == file->f ) { - free(file); - return NULL; - } - - return file; -} - -int buffile_close ( buffile * file ) { - int retval=0; - - if (NULL == file) - return -1; - if ( NULL != file->f ) - retval = fclose( file->f ); - if ( NULL != file->buf ) - free ( file->buf ); - free (file); - file = NULL; - - return retval; -} - -char * buffile_read ( buffile * file, size_t n ) { - char * returnbuf=NULL; - - if( NULL == file ) - return NULL; - - returnbuf = malloc(n); - if( NULL == returnbuf) - return NULL; - - if( NULL == file->buf ) { - file->buf = malloc(FILECHUNKSIZE); - if( NULL == file->buf ) - return NULL; - } - - if( file->pos >= file->bytesread ) { - if( !( file->bytesread = fread( file->buf, 1, FILECHUNKSIZE, file->f ))) { - /* We're at the end*/ - returnbuf[0]=0; - return returnbuf; - } - file->pos = 0; - } - strncpy(returnbuf, file->buf + (file->pos++), n); - return returnbuf; -} - diff --git a/shared/fileio.h b/shared/fileio.h deleted file mode 100644 index 1ccb827..0000000 --- a/shared/fileio.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * fileio.h - * This file is part of LCDd, the lcdproc server. - * - * This file is released under the GNU General Public License. Refer to the - * COPYING file distributed with this package. - * - * Copyright (c) 2003, Rene Wagner - * - * - * Defines routines to read from buffered files. - * - */ - -#ifndef FILEIO_H -#define FILEIO_H - -#include - -typedef struct buffile { - FILE * f; - char * buf; - int bytesread, pos; -} buffile; - -buffile *buffile_open( const char *path, const char *mode ); -/* Opens the given file and returns a pointer to the corresponding - * buffile object. - */ -int buffile_close ( buffile * file ); -/* Tries to close the file corresponding to the given buffile - * object and to free the memory used by the buffile object itself. - * Returns 0 on success, return value of fclose(3) in case of errors - * with fclose. - */ -char * buffile_read ( buffile * file, size_t n ); -/* Reads n bytes from the given buffile object. - */ - -#endif