home *** CD-ROM | disk | FTP | other *** search
- /* log.c */
- /*
-
- * Copyright 1994 A.Oliver De Guzman
- * All rights reserved
-
- * Permission is granted to any individual to copy, use, and/or
- * distribute this software provided that the distribution retains this
- * entire copyright notice. No part of this software may be used and/or
- * sold for profit or used with any commercial product.
-
- * DISCLAIMER:
- * This software comes with NO WARRANTIES of any kind. In no event
- * will the author be liable for any financial, physical, moral, and/or
- * mental damages incurred directly or indirectly by the use or intent
- * to use of this software.
-
- */
-
- #include <stdlib.h>
- #include <stdio.h>
- #include <ctype.h>
- #include <time.h>
- #include "log.h"
-
- FILE *openlog(fname)
- char *fname;
- {
- return(fopen(fname, "a+"));
- }
-
- int closelog(fp)
- FILE *fp;
- {
- if (fp) fclose(fp);
- }
-
- int logger(fp, s)
- FILE *fp;
- char *s;
- {
- time_t t;
- char st[64];
-
- if (fp){
- t = time(NULL);
- strcpy(st, ctime(&t));
- st[strlen(st)-1] = '\0';
- fprintf(fp, "%s %s\n", st, s);
- fflush(fp);
- }
- }
-