From ed7adb7cf69b2f423b52fcfaba4faf84edf15a11 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 10 Mar 2005 19:33:12 +0000 Subject: [PATCH] (loginit): Working directory is the data directory; simplify. (loginit, logerror): Use plain char * instead of s_char *. --- include/prototypes.h | 4 ++-- src/lib/common/log.c | 20 ++++++++------------ 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/include/prototypes.h b/include/prototypes.h index 0cc0dd1fb..2fd70b6b5 100644 --- a/include/prototypes.h +++ b/include/prototypes.h @@ -307,8 +307,8 @@ extern int has_units_with_mob(coord, coord, natid); extern int adj_units(coord, coord, natid); extern int has_helpful_engineer(coord x, coord y, natid cn); /* log.c */ -extern void loginit(s_char *); -extern void logerror(s_char *, ...) ATTRIBUTE((format (printf, 1, 2))); +extern void loginit(char *); +extern void logerror(char *, ...) ATTRIBUTE((format (printf, 1, 2))); extern int oops(char *, char *, int); /* maps.c */ extern int draw_map(int, s_char, int, struct nstr_sect *, int); diff --git a/src/lib/common/log.c b/src/lib/common/log.c index 36e2b0d54..b402aeb7c 100644 --- a/src/lib/common/log.c +++ b/src/lib/common/log.c @@ -46,30 +46,26 @@ #include "common.h" #include "optlist.h" -static s_char *logfile = 0; +static char logfile[32]; /* - * Points logfile at datadir/"program".log + * Points logfile at PROGRAM.log */ void -loginit(s_char *program) +loginit(char *program) { - s_char buf[1024]; - - sprintf(buf, "%s/%s.log", datadir, program); - logfile = malloc(strlen(buf) + 1); - strcpy(logfile, buf); + sprintf(logfile, "%.*s.log", (int)sizeof(logfile) - 5, program); } /*VARARGS*/ void -logerror(s_char *format, ...) +logerror(char *format, ...) { va_list list; time_t now; - s_char buf[512]; - s_char cbuf[512]; - s_char buf1[512]; + char buf[512]; + char cbuf[512]; + char buf1[512]; int logf; s_char *p; -- 2.43.0