new vers.

This commit is contained in:
zolliker
2005-06-29 14:15:53 +00:00
parent a4d9b5e5cf
commit 371ec68262
10 changed files with 61 additions and 19 deletions

View File

@@ -5,6 +5,9 @@
#include <signal.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "myc_mem.h"
#include "myc_err.h"
#include "coc_util.h"
@@ -14,6 +17,7 @@
#include "myc_time.h"
#include "tecs_lsc.h"
#include "tecs_data.h"
#include "logger.h"
/* --- non ANSI signal --- */
#ifndef SIGPIPE
@@ -170,7 +174,7 @@ static int
lockAlarm,
cntError;
int tim, rdTim; /* actual time, read Time */
static int tim, rdTim; /* actual time, read Time */
static int decod[8]={21,20,17,16,5,4,1,0}; /* for code conversion */
@@ -2840,6 +2844,7 @@ int main(int argc, char *argv[]) {
int i, iret;
char *inistr;
char buf[256], opt;
char loggerDir[256];
signal(SIGPIPE, ignore_forever);
@@ -3060,8 +3065,18 @@ int main(int argc, char *argv[]) {
str_copy(statusBuf, "starting up");
logfileStatusBuf(statusBuf);
str_copy(buf, logDir);
str_append(buf, serverId);
if (logDir[0] == '/') {
str_copy(buf, logDir);
} else {
getcwd(buf, sizeof buf);
str_append(buf, "/");
ERR_I(str_append(buf, logDir));
}
ERR_I(str_append(buf, serverId));
ERR_I(str_copy(loggerDir, buf));
mkdir(loggerDir, S_IRWXU+S_IRGRP+S_IXGRP+S_IROTH+S_IXOTH);
/* do not check return value */
LoggerSetDir(loggerDir);
logfile=logfileInit(buf, logIt, use_stdout, logIt && use_stdout);
CocDefStr(logfile, RD);
logfileOut(LOG_MAIN ,"\n");