get it to build
This commit is contained in:
25
SICSmain.c
25
SICSmain.c
@ -20,6 +20,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include "nserver.h"
|
||||
#include "servlog.h"
|
||||
|
||||
@ -32,6 +33,12 @@ pServer pServ = NULL;
|
||||
|
||||
#define DEFAULTINIFILE "servo.tcl"
|
||||
|
||||
int usage(const char *name)
|
||||
{
|
||||
fprintf(stderr, "usage: %s [-d] [-nolog] <config.tcl>\n", name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
The Servers Main program. May take one argument: the name of an
|
||||
initialisation file
|
||||
@ -40,22 +47,36 @@ pServer pServ = NULL;
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int iRet;
|
||||
int daemonize = 0;
|
||||
char *file = NULL;
|
||||
int i;
|
||||
int i, firstArg = 1;
|
||||
|
||||
if (argc < 2)
|
||||
return usage(argv[0]);
|
||||
|
||||
/* initialise, will die on you if problems */
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcasecmp(argv[1], "-d") == 0) {
|
||||
daemonize = 1;
|
||||
firstArg = 2;
|
||||
}
|
||||
for (i = firstArg; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-nolog") == 0) {
|
||||
SICSLogEnable(0);
|
||||
} else if (file == NULL) {
|
||||
file = argv[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (file == NULL)
|
||||
return usage(argv[0]);
|
||||
|
||||
iRet = InitServer(file, &pServ);
|
||||
if (!iRet) {
|
||||
printf("Unrecoverable error on server startup, exiting.........\n");
|
||||
exit(1);
|
||||
}
|
||||
if (daemonize == 1)
|
||||
daemon(1, 1);
|
||||
|
||||
|
||||
RunServer(pServ);
|
||||
|
Reference in New Issue
Block a user