Merge commit 'refs/merge-requests/1' of ssh://gitorious.psi.ch/sinqdev/sics into merge-requests/1

First merge with ANSTO which compiles

Conflicts:
	SICSmain.c
	asynnet.c
	confvirtualmot.c
	counter.c
	devexec.c
	drive.c
	exebuf.c
	hipadaba.c
	interface.h
	make_gen
	motor.c
	nserver.c
	nwatch.c
	ofac.c
	protocol.c
	sicshipadaba.c
This commit is contained in:
2015-04-23 17:00:33 +02:00
93 changed files with 3977 additions and 1572 deletions

View File

@ -20,19 +20,25 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include "nserver.h"
#include "servlog.h"
extern void KeepStartupCommands(); /* ofac.c */
/***************************** Necessary Globals ****************************/
IPair *pSICSOptions = NULL;
pServer pServ = NULL;
/* ========================= Less dreadful file statics =================== */
#define DEFAULTINIFILE "servo.tcl"
int usage(const char *name)
{
fprintf(stderr, "usage: %s [-d] [-nolog] <config.tcl>\n", name);
fprintf(stderr, " -d: daemonize the process\n");
fprintf(stderr, " -nolog: disable log file writing\n");
return 1;
}
/*---------------------------------------------------------------------------
The Servers Main program. May take one argument: the name of an
initialisation file
@ -41,24 +47,52 @@ pServer pServ = NULL;
int main(int argc, char *argv[])
{
int iRet;
int daemonize = 0;
char *file = NULL;
int i;
int i, firstArg = 1;
extern pServer pServ;
char *argv0;
argv0 = argv[0];
if (argc < 2)
return usage(argv[0]);
/* initialise, will die on you if problems */
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-nolog") == 0) {
SICSLogEnable(0);
}else if(strcmp(argv[i],"-keepstartup") == 0){
KeepStartupCommands();
for (i = firstArg; i < argc; i++) {
if (argv[i][0] == '-') {
if (strcasecmp(argv[i], "-nolog") == 0) {
SICSLogEnable(0);
}else if(strcmp(argv[i],"-keepstartup") == 0){
KeepStartupCommands();
#ifdef SITE_ANSTO
} else if (strcasecmp(argv[i], "-v") == 0) {
extern void SiteReportVersion(void);
SiteReportVersion();
return 0;
#endif
} else if (strcasecmp(argv[i], "-d") == 0) {
daemonize = 1;
} else {
fprintf(stderr, "Unrecognized option ignored: %s\n", argv[i]);
}
} else if (file == NULL) {
file = argv[i];
} else {
fprintf(stderr, "Unrecognized argument ignored: %s\n", 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);
@ -68,28 +102,3 @@ int main(int argc, char *argv[])
exit(0);
}
/*--------------------------------------------------------------------------*/
SicsInterp *GetInterpreter(void)
{
return pServ->pSics;
}
/*--------------------------------------------------------------------------*/
pExeList GetExecutor(void)
{
return pServ->pExecutor;
}
/*------------------------------------------------------------------------*/
void StopExit(void)
{
if (pServ) {
StopServer(pServ);
}
}
/*-------------------------------------------------------------------------*/
pTaskMan GetTasker(void)
{
return pServ->pTasker;
}