/*->c.ser */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <ctype.h>
#include <time.h>
#include <stdarg.h> 

#include "h.os"
#include "h.wimp"
#include "h.bbc"
#include "h.flex"
#include "h.swis"

#include "h.Drawlevel0"

#include "h.def"

#include "h.wos"
#include "h.strdef"
#include "h.main"
#include "h.mym"
#include "h.fsx"
#include "h.timex"
#include "h.pr"
#include "h.buffer"
#include "h.state"
#include "h.dir"
#include "h.txfax"
#include "h.view"
#include "h.batch"
#include "h.trans"
#include "h.config"
#include "h.sched"
#include "h.xext"
#include "h.script"

#include "h.ser"



int  server;


/* system server name */

char servername[SNAMELEN];
char servercom1[SCOMMANDLEN];
char servercom2[SCOMMANDLEN];



int runserver(int mode,char * name,char * p1,char * p2)
{
 int code;
 char filename[128];

 sprintf(filename,"%s.%s",path(SRVP),name);

 code=runscript(filename,0);
 if(code)
 {
  xexec5("main",p1,p2,&mode);  /* nb writes back return value to mode */
  xremfile();
  changedriver();
  return(mode);
 }

 return(1);
}


void runanswerserver(int mode)
{
 runserver(mode,servername,servercom1,servercom2);
}


/* setserver(string & name,string & com1,string & com2); */

void setserver(int fp)
{
 server=stack[fp+0];
 strcpy(servername,stringptr(stack[fp+1]));
 strcpy(servercom1,stringptr(stack[fp+2]));
 strcpy(servercom2,stringptr(stack[fp+3]));
}

