diff options
| author | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-02-01 22:59:06 +0000 |
|---|---|---|
| committer | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-02-01 22:59:06 +0000 |
| commit | 6d4e1eae16b84918009625a866104ec26a234277 (patch) | |
| tree | a340a8a547a60c9f63c8dfafe8909242f9c9bbd8 /src/logFile.c | |
nahranie tarballu tuxanci-ng na SVN server
Dusan Durech ( Oroborus )
git-svn-id: http://opensvn.csie.org/tuxanci_ng@1 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/logFile.c')
| -rw-r--r-- | src/logFile.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/logFile.c b/src/logFile.c new file mode 100644 index 0000000..12a4df8 --- /dev/null +++ b/src/logFile.c @@ -0,0 +1,46 @@ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/stat.h> +#include <assert.h> + +typedef struct logFile_struct +{ + char *name; + FILE *file; +} logFile_t; + +logFile_t* newLogFile(char *s) +{ + logFile_t *new; + + assert( s != NULL ); + + new = malloc( sizeof(logFile_t) ); + memset(new, 0, sizeof(logFile_t) ); + + new->name = strdup(s); + new->file = fopen(new->name, "a+"); + + assert( new->file != NULL ); + + return new; +} + +int writeLog(logFile_t *p, char *s) +{ + assert( p != NULL ); + assert( s != NULL ); + + return fprintf(p->file, s); +} + +void destroyLogFile(logFile_t *p) +{ + assert( p != NULL ); + + free(p->name); + fclose(p->file); + free(p); +} |