(loginit, main): Pass log file basename as parameter.

(logerror): Require prior call of loginit().
(empth_exit) [_EMPTH_WIN32]: Don't print the log file name here, it's
not modular.
(program, getlogfile): Unused, remove.
This commit is contained in:
Markus Armbruster 2004-02-19 21:15:16 +00:00
parent 379e0a61c3
commit 8d438a4601
4 changed files with 4 additions and 18 deletions

View file

@ -332,7 +332,7 @@ 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(void);
extern void loginit(s_char *);
extern void logerror(s_char *, ...);
/* maps.c */
extern int draw_map(int, s_char, int, struct nstr_sect *, int);

View file

@ -49,19 +49,12 @@
static s_char *logfile = 0;
s_char *
getlogfile(void)
{
return (s_char *)logfile;
}
/*
* Points logfile at datadir/"program".log
*/
void
loginit(void)
loginit(s_char *program)
{
extern s_char program[];
s_char buf[1024];
#if !defined(_WIN32)
@ -85,8 +78,6 @@ logerror(s_char *format, ...)
int logf;
s_char *p;
if (logfile == 0)
loginit();
va_start(list, format);
vsprintf(buf, format, list);
if ((p = strchr(buf, '\n')) != 0)

View file

@ -454,8 +454,6 @@ empth_self(void)
void
empth_exit(void)
{
s_char *getlogfile();
loc_Thread_t *pThread =
(loc_Thread_t *)TlsGetValue(loc_GVAR.dwTLSIndex);
@ -466,9 +464,6 @@ empth_exit(void)
if (pThread->bMainThread) {
char buf[20];
/* The main line. Wait forever. */
if (getlogfile() == (s_char *)0)
loginit();
printf("log file: %s\n", getlogfile());
while (1) {
printf("\nEmpire Server>");
fgets(buf, sizeof(buf), stdin);

View file

@ -67,8 +67,6 @@
#include "server.h"
#include "prototypes.h"
s_char program[] = "server";
void nullify_objects(void);
void init_files(void);
void close_files(void);
@ -101,6 +99,8 @@ main(int argc, char **argv)
struct sigaction act;
#endif /* POSIXSIGNALS */
loginit("server");
#if !defined(_WIN32)
mainpid = getpid();