(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:
parent
379e0a61c3
commit
8d438a4601
4 changed files with 4 additions and 18 deletions
|
@ -332,7 +332,7 @@ 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(void);
|
extern void loginit(s_char *);
|
||||||
extern void logerror(s_char *, ...);
|
extern void logerror(s_char *, ...);
|
||||||
/* 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);
|
||||||
|
|
|
@ -49,19 +49,12 @@
|
||||||
|
|
||||||
static s_char *logfile = 0;
|
static s_char *logfile = 0;
|
||||||
|
|
||||||
s_char *
|
|
||||||
getlogfile(void)
|
|
||||||
{
|
|
||||||
return (s_char *)logfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Points logfile at datadir/"program".log
|
* Points logfile at datadir/"program".log
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
loginit(void)
|
loginit(s_char *program)
|
||||||
{
|
{
|
||||||
extern s_char program[];
|
|
||||||
s_char buf[1024];
|
s_char buf[1024];
|
||||||
|
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
|
@ -85,8 +78,6 @@ logerror(s_char *format, ...)
|
||||||
int logf;
|
int logf;
|
||||||
s_char *p;
|
s_char *p;
|
||||||
|
|
||||||
if (logfile == 0)
|
|
||||||
loginit();
|
|
||||||
va_start(list, format);
|
va_start(list, format);
|
||||||
vsprintf(buf, format, list);
|
vsprintf(buf, format, list);
|
||||||
if ((p = strchr(buf, '\n')) != 0)
|
if ((p = strchr(buf, '\n')) != 0)
|
||||||
|
|
|
@ -454,8 +454,6 @@ empth_self(void)
|
||||||
void
|
void
|
||||||
empth_exit(void)
|
empth_exit(void)
|
||||||
{
|
{
|
||||||
s_char *getlogfile();
|
|
||||||
|
|
||||||
loc_Thread_t *pThread =
|
loc_Thread_t *pThread =
|
||||||
(loc_Thread_t *)TlsGetValue(loc_GVAR.dwTLSIndex);
|
(loc_Thread_t *)TlsGetValue(loc_GVAR.dwTLSIndex);
|
||||||
|
|
||||||
|
@ -466,9 +464,6 @@ empth_exit(void)
|
||||||
if (pThread->bMainThread) {
|
if (pThread->bMainThread) {
|
||||||
char buf[20];
|
char buf[20];
|
||||||
/* The main line. Wait forever. */
|
/* The main line. Wait forever. */
|
||||||
if (getlogfile() == (s_char *)0)
|
|
||||||
loginit();
|
|
||||||
printf("log file: %s\n", getlogfile());
|
|
||||||
while (1) {
|
while (1) {
|
||||||
printf("\nEmpire Server>");
|
printf("\nEmpire Server>");
|
||||||
fgets(buf, sizeof(buf), stdin);
|
fgets(buf, sizeof(buf), stdin);
|
||||||
|
|
|
@ -67,8 +67,6 @@
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
|
|
||||||
s_char program[] = "server";
|
|
||||||
|
|
||||||
void nullify_objects(void);
|
void nullify_objects(void);
|
||||||
void init_files(void);
|
void init_files(void);
|
||||||
void close_files(void);
|
void close_files(void);
|
||||||
|
@ -101,6 +99,8 @@ main(int argc, char **argv)
|
||||||
struct sigaction act;
|
struct sigaction act;
|
||||||
#endif /* POSIXSIGNALS */
|
#endif /* POSIXSIGNALS */
|
||||||
|
|
||||||
|
loginit("server");
|
||||||
|
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
mainpid = getpid();
|
mainpid = getpid();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue