(loginit): Working directory is the data directory; simplify.

(loginit, logerror): Use plain char * instead of s_char *.
This commit is contained in:
Markus Armbruster 2005-03-10 19:33:12 +00:00
parent 21088661d6
commit ed7adb7cf6
2 changed files with 10 additions and 14 deletions

View file

@ -307,8 +307,8 @@ extern int has_units_with_mob(coord, coord, natid);
extern int adj_units(coord, coord, natid); extern int adj_units(coord, coord, natid);
extern int has_helpful_engineer(coord x, coord y, natid cn); extern int has_helpful_engineer(coord x, coord y, natid cn);
/* log.c */ /* log.c */
extern void loginit(s_char *); extern void loginit(char *);
extern void logerror(s_char *, ...) ATTRIBUTE((format (printf, 1, 2))); extern void logerror(char *, ...) ATTRIBUTE((format (printf, 1, 2)));
extern int oops(char *, char *, int); extern int oops(char *, char *, int);
/* maps.c */ /* maps.c */
extern int draw_map(int, s_char, int, struct nstr_sect *, int); extern int draw_map(int, s_char, int, struct nstr_sect *, int);

View file

@ -46,30 +46,26 @@
#include "common.h" #include "common.h"
#include "optlist.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 void
loginit(s_char *program) loginit(char *program)
{ {
s_char buf[1024]; sprintf(logfile, "%.*s.log", (int)sizeof(logfile) - 5, program);
sprintf(buf, "%s/%s.log", datadir, program);
logfile = malloc(strlen(buf) + 1);
strcpy(logfile, buf);
} }
/*VARARGS*/ /*VARARGS*/
void void
logerror(s_char *format, ...) logerror(char *format, ...)
{ {
va_list list; va_list list;
time_t now; time_t now;
s_char buf[512]; char buf[512];
s_char cbuf[512]; char cbuf[512];
s_char buf1[512]; char buf1[512];
int logf; int logf;
s_char *p; s_char *p;