diff --git a/tecs/Makefile b/tecs/Makefile index d336234a..c6472031 100644 --- a/tecs/Makefile +++ b/tecs/Makefile @@ -9,7 +9,7 @@ OBJ= tecc.o client.o coc.o buf.o errhdl.o util.o \ #------------ for DigitalUnix CC=cc -CFLAGS= -std1 -g -c -I. +CFLAGS= -std1 -g -c -warnprotos -I. .c.o: $(CC) $(CFLAGS) $*.c diff --git a/tecs/buf.c b/tecs/buf.c index 664268d2..d2af5c75 100644 --- a/tecs/buf.c +++ b/tecs/buf.c @@ -7,21 +7,43 @@ #define TWO28 268435456.0 #define MAXINT 2147483647 -/* static char *null="\0"; */ +int buf_encode_int(char b[4]) { + int i; + i=(unsigned char)b[0]; + if (i>=128) i=i-256; + i=i*256+(unsigned char)b[1]; + i=i*256+(unsigned char)b[2]; + i=i*256+(unsigned char)b[3]; + return(i); +} + +void buf_decode_int(char b[4], int i) { + if (i<0) { + i+=0x10000000; + b[0]=i/0x01000000+128; + i=i % 0x01000000; + } else { + b[0]=i/0x01000000; + i=i % 0x01000000; + } + b[1]=i/0x10000; i=i % 0x10000; + b[2]=i/0x100; + b[3]=i % 0x100; +} int buf_get_int(buf_type *buf) { char *b; - int *res; + int res; b=buf->buf; if (b==NULL) return(0); if (b[0]!=1 || buf->size<5) {buf->buf=NULL; return(0); } b++; - res=(int *)b; + res=buf_encode_int(b); b+=4; buf->size-=5; buf->buf=b; - return(*res); + return(res); } char *buf_get_str(buf_type *buf) @@ -41,17 +63,17 @@ char *buf_get_str(buf_type *buf) float buf_get_float(buf_type *buf) { char *b; float res; - int *mant, iexp; + int mant, iexp; b=buf->buf; if (b==NULL) return(0.0); if (b[0]!=2 || buf->size<6) { buf->buf=NULL; return(0.0); } iexp=b[1]; b+=2; - mant=(int *)b; + mant=buf_encode_int(b); b+=4; buf->size-=6; - res=(float)ldexp(*mant/TWO28, iexp); + res=(float)ldexp(mant/TWO28, iexp); buf->buf=b; return res; } @@ -69,8 +91,8 @@ void buf_put_int(buf_type *buf, int val) if (b==NULL) return; b[0]=1; b++; - if (buf->size<=4) {buf->buf=NULL; return; } - *(int *)b=val; + if (buf->size<=4) { buf->buf=NULL; return; } + buf_decode_int(b, val); b+=4; buf->size-=5; buf->buf=b; @@ -125,7 +147,7 @@ void buf_put_float(buf_type *buf, float val) b[0]=2; b[1]=iexp; b+=2; - *(int *)b=mant; + buf_decode_int(b, mant); b+=4; buf->size-=6; buf->buf=b; diff --git a/tecs/logfile.c b/tecs/logfile.c index b99e5f13..6057766e 100644 --- a/tecs/logfile.c +++ b/tecs/logfile.c @@ -20,6 +20,8 @@ static char ebuf[20000]=""; static char *eptr=&ebuf[0]; static int lastStamp=0; static int notDated=0; +static int logMask=0; +static int wrtMask=0; int ftime (struct timeb *__timeptr); /* for some reason not defined in timeb.h with flag -std1 */ @@ -30,7 +32,6 @@ void logfileOpen(int first) { struct tm *tim; struct timeb btim; - dirty=1; if (logfileStd) { fil=stdout; return; @@ -72,8 +73,35 @@ void logfileInit(char *path, int nodate) { logfileOpen(1); } -void logfileStamp(char *text) -{ struct tm *tim; +void logfileOut(int mask, const char *fmt, ...) +{ va_list ap; + + assert(mask>0 && mask<32); + va_start(ap, fmt); + if (eptr!=NULL) { + if (eptr-ebuf > sizeof(ebuf)-512) { + sprintf(eptr, "... buffer full ... \1\1"); + eptr=NULL; + } else { + vsprintf(eptr, fmt, ap); + assert(NULL==strchr(eptr, '\1')); + eptr+=strlen(eptr); + eptr[0]='\1'; /* put \1 as separator between blocks */ + eptr[1]=mask; + eptr[2]='\0'; + eptr+=2; + } + } + va_end(ap); + wrtMask=wrtMask | mask; +} + +void logfileMask(int mask) { + logMask=logMask | mask; +} + +void logfileStamp(void) { + struct tm *tim; struct timeb btim; int stamp; @@ -84,23 +112,42 @@ void logfileStamp(char *text) if (stamp new day -> new logfile */ if (fil!=NULL) { fclose(fil); fil=NULL; } logfileOpen(0); - } else { - if (!dirty) return; -#ifdef __VMS - if (fil==NULL) logfileOpen(0); -#endif } - lastStamp=stamp; - fprintf(fil, "%02d:%02d %s\n",tim->tm_hour,tim->tm_min,text); + lastStamp=stamp; + logfileOut(LOG_MAIN, "--- %02d:%02d ---\n",tim->tm_hour,tim->tm_min); dirty=0; } -#ifdef __VMS - if (!logfileStd) { fclose(fil); fil=NULL; } -#endif } -void logfileUpd() -{ +void logfileWrite(int mask) { + char *s, *next; + + logMask=logMask | mask; + if (dirty) logfileStamp(); + +#ifdef __VMS + if (fil==NULL) logfileOpen(0); +#endif + s=ebuf; + if (*s!='\0' && wrtMask & logMask) { + logfileStamp(); + dirty=1; + + next=strchr(s, '\1'); + while (next!=NULL) { + *next='\0'; + next++; + if (*next & logMask) { + fprintf(fil, "%s", s); + } + s=next+1; + next=strchr(s, '\1'); + } + } + ebuf[0]='\0'; + eptr=&ebuf[0]; + logMask=0; + wrtMask=0; #ifdef __VMS if (!logfileStd) { fclose(fil); fil=NULL; } #else @@ -108,65 +155,18 @@ void logfileUpd() #endif } -void logfileOutTmp(char *fmt, ...) -{ va_list ap; - - va_start(ap, fmt); - if (eptr!=NULL) { - if (eptr-ebuf > sizeof(ebuf)-512) { - sprintf(eptr, "... buffer full ... \n"); - eptr=NULL; - } else { - vsprintf(eptr, fmt, ap); - eptr+=strlen(eptr); - } - } - va_end(ap); -} - -void logfileOut(char *fmt, ...) -{ va_list ap; - - if (!dirty) { dirty=1; logfileStamp(""); } - dirty=1; - -#ifdef __VMS - if (fil==NULL) logfileOpen(0); -#endif - va_start(ap, fmt); - vfprintf(fil, fmt, ap); - va_end(ap); -} - -void logfilePurge() { - ebuf[0]='\0'; - eptr=&ebuf[0]; -} - -void logfileWriteTmp() { - - if (!dirty) { dirty=1; logfileStamp(""); } - dirty=1; - -#ifdef __VMS - if (fil==NULL) logfileOpen(0); -#endif - if (ebuf[0]!='\0') fprintf(fil, "%s", ebuf); - ebuf[0]='\0'; - eptr=&ebuf[0]; -} - void logfileShowErr(char *text) { - logfileWriteTmp(); + logfileWrite(LOG_ALL); /* write all */ ErrWrite(fil, text); } void logfileClose() -{ if (fil!=NULL) { fclose(fil); fil=NULL; } +{ logfileWrite(LOG_MAIN); + if (fil!=NULL) { fclose(fil); fil=NULL; } } -void logfileOutBuf(buf_type *buf) +void logfileOutBuf(int mask, buf_type *buf) { char *obuf, *str; int osiz; @@ -174,17 +174,17 @@ void logfileOutBuf(buf_type *buf) osiz=buf->size; while (buf->size>0) { if (buf->buf==NULL) { - logfileOutTmp(" ?"); break; + logfileOut(mask, " ?"); break; } else if (buf->buf[0]==1) { - logfileOutTmp(" %d", buf_get_int(buf)); + logfileOut(mask, " %d", buf_get_int(buf)); } else if (buf->buf[0]==2) { - logfileOutTmp(" %f", buf_get_float(buf)); + logfileOut(mask, " %f", buf_get_float(buf)); } else { str=buf_get_str(buf); if (*str=='\0') { - logfileOutTmp(" ."); + logfileOut(mask, " ."); } else { - logfileOutTmp(" %s", str); + logfileOut(mask, " %s", str); } } } diff --git a/tecs/logfile.h b/tecs/logfile.h index 916073ae..e921f487 100644 --- a/tecs/logfile.h +++ b/tecs/logfile.h @@ -1,14 +1,17 @@ #include "buf.h" +#define LOG_ALL 31 +#define LOG_SER 8 +#define LOG_NET 4 +#define LOG_WARN 2 +#define LOG_MAIN 1 + void logfileInit(char *path, int nodate); -void logfileUpd(void); -void logfileStamp(char *text); -void logfileOut(char *fmt, ...); -void logfileOutTmp(char *fmt, ...); -void logfileOutBuf(buf_type *buf); +void logfileOut(int mask, const char *fmt, ...); +void logfileOutBuf(int mask, buf_type *buf); void logfileShowErr(char *text); -void logfilePurge(void); -void logfileWriteTmp(void); +void logfileMask(int mask); +void logfileWrite(int mask); void logfileClose(void); extern int logfileStd; diff --git a/tecs/lsc.c b/tecs/lsc.c index dfcebf6f..58e93e08 100644 --- a/tecs/lsc.c +++ b/tecs/lsc.c @@ -31,7 +31,7 @@ int LscEqPar(char *par, char *res) { i1=sscanf(plist[i], "%f%1s", &f1, &ch1); i2=sscanf(rlist[i], "%f%1s", &f2, &ch2); if (i1!=1 || i2!=1 || abs(f1-f2)>1e-4+abs(f1)*5e-6) { - logfileOut("%s#%s\n", plist[i], rlist[i]); + logfileOut(LOG_WARN, "%s#%s\n", plist[i], rlist[i]); return(0); } } @@ -94,7 +94,10 @@ int LscCmdChk(SerChannel *ser, char *cmds) { r=str_split(res, ';', rlist, &n); if (r==NULL || n!=j) continue; for (i=0; iasyn_info.port=port; ser->asyn_info.chan=chan; - ser->logIt=logIt; A_CHK(AsynSrv_Open(&ser->asyn_info)); if (msecTmo==0) msecTmo=5000; A_CHK(AsynSrv_Config(&ser->asyn_info, "msecTmo", msecTmo, "idleHdl", idleHdl, NULL)); @@ -86,14 +84,14 @@ char *SerCmd(SerChannel *serch, char *cmnd) { if (l>=SER_BUF_LEN-1) ERR_COD(ENOBUFS); ser=(struct SerChan *)serch; - if (ser->logIt) logfileOutTmp(">%s\n", cmnd); + logfileOut(LOG_SER, ">%s\n", cmnd); cmnd[l]=ser->asyn_info.eot[1]; cmnd[l+1]='\0'; A_CHK(AsynSrv_SendCmnds(&ser->asyn_info, &ser->to_host, &ser->from_host, cmnd, NULL)); result=AsynSrv_GetReply(&ser->asyn_info, &ser->from_host, NULL); if (result==NULL) ERR_MSG("empty result"); /* if (idleHandler!=NULL) idleHandler(50,0); */ - if (ser->logIt) logfileOutTmp("<%s\n", result); + logfileOut(LOG_SER, "<%s\n", result); return(result); OnError: return(NULL); } diff --git a/tecs/serutil.h b/tecs/serutil.h index 21f5e5c4..dfd5d8d6 100644 --- a/tecs/serutil.h +++ b/tecs/serutil.h @@ -2,7 +2,7 @@ typedef struct { int private; } SerChannel; -SerChannel *SerOpen(const char *host, int logIt, int msecTmo, void (*idleHdl)(int,int)); +SerChannel *SerOpen(const char *host, int msecTmo, void (*idleHdl)(int,int)); char *SerCmdC(SerChannel *ser, const char *cmnd); char *SerCmd(SerChannel *ser, char *cmnd); int SerClose(SerChannel *ser); diff --git a/tecs/server.c b/tecs/server.c index 83a52ab2..b8bf7e34 100644 --- a/tecs/server.c +++ b/tecs/server.c @@ -29,19 +29,16 @@ int CocInitServer(int bufsize, int port) { /* first try to connect to an existing server */ - logfileStamp("start server"); - ERR_SI(mainFd=socket(AF_INET, SOCK_STREAM, 0)); i = 1; ERR_SI(setsockopt(mainFd,SOL_SOCKET,SO_REUSEADDR,&i,sizeof(int))); /* allow quick port reuse */ ERR_I(CocCreateSockAdr(&sadr, NULL, port)); ERR_SI(bind(mainFd, (struct sockaddr *)&sadr, sizeof(sadr))); - logfileOut("created server on port %d\n", port); + logfileOut(LOG_MAIN, "created server on port %d\n", port); ERR_SI(listen(mainFd, 8)); FD_ZERO(&mask); FD_SET(mainFd, &mask); maxfd=mainFd+1; - logfileUpd(); return(0); OnError: return(-1); } @@ -64,7 +61,6 @@ int CocHandle1Request(int tmo_msec, int fd) { ERR_SI(i=select(maxfd,&rmask,NULL,NULL,&tmo)); if (fd>0 && FD_ISSET(fd, &rmask)) return(1); - logfileStamp(""); if (FD_ISSET(mainFd, &rmask)) { ERR_SI(newfd=accept(mainFd, (struct sockaddr *)&cadr, &cadrlen)); FD_SET(newfd, &mask); @@ -78,18 +74,17 @@ int CocHandle1Request(int tmo_msec, int fd) { cList->next=cl; h=gethostbyaddr(&cadr.sin_addr, 4, AF_INET); if (h==NULL) { - logfileOut("(%d) open from %s\n", newfd, "local"); + logfileOut(LOG_MAIN, "(%d) open from %s\n", newfd, "local"); } else { - logfileOut("(%d) open from %s\n", newfd, h->h_name); + logfileOut(LOG_MAIN, "(%d) open from %s\n", newfd, h->h_name); } - logfileUpd(); } else { cl0=cList; cl=cl0->next; while (cl!=NULL) { if (FD_ISSET(cl->fd, &rmask)) { buf->usize=recv(cl->fd, buf->start, buf->isize, 0); if (buf->usize<=0) { - logfileOut("(%d) disconnected\n",cl->fd); + logfileOut(LOG_MAIN, "(%d) disconnected\n",cl->fd); close(cl->fd); FD_CLR(cl->fd, &mask); cl0->next=cl->next; @@ -104,19 +99,21 @@ int CocHandle1Request(int tmo_msec, int fd) { buf_reset(buf); err=NULL; varname=buf_get_str(buf); - logfileOutTmp("(%d) ", cl->fd); + logfileOut(LOG_NET, "(%d) ", cl->fd); if (varname[0]=='#') { /* access code */ if (0==strcmp(varname,"#rdacc")) { - logfileOutTmp(" set read mode"); + logfileOut(LOG_MAIN, " set read mode\n"); cl->mode=1; } else if (0==strcmp(varname,"#rwacs")) { - logfileOutTmp(" set write mode"); + logfileOut(LOG_MAIN, " set write mode\n"); cl->mode=2; } else { err="bad access code"; } + buf_put_end(bufo); } else if (cl->mode==0) { err="no access"; + buf_put_end(bufo); } else { while (1) { if (varname[0]=='[') { @@ -151,25 +148,25 @@ int CocHandle1Request(int tmo_msec, int fd) { if (buf_size(buf)<0) { err="syntax error"; break; } } buf_reset(buf); - logfileOutBuf(buf); + logfileOutBuf(LOG_NET, buf); + buf_put_end(bufo); + logfileOut(LOG_NET, " |"); + logfileOutBuf(LOG_NET, bufo); } - buf_put_end(bufo); - logfileOutTmp(" |"); - logfileOutBuf(bufo); if (err==NULL) { - logfileOutTmp("\n"); + logfileOut(LOG_NET, "\n"); } else { buf_put_start(bufo); /* reset output */ buf_put_str(bufo, err); /* put error message */ buf_put_end(bufo); - logfileOutTmp(" (%s)\n", err); + logfileOut(LOG_NET, " (%s)\n", err); + logfileMask(LOG_NET); } ERR_SI(send(cl->fd, bufo->buf, bufo->size, 0)); } } cl0=cl; cl=cl->next; } - logfileUpd(); } return(status); OnError: return(-1); diff --git a/tecs/tecc.c b/tecs/tecc.c index 68d2149d..6e5d1b7c 100644 --- a/tecs/tecc.c +++ b/tecs/tecc.c @@ -23,19 +23,19 @@ pTecsClient TeccInit(char *startcmd, int port) { int TeccSetDev(pTecsClient conn, char *dev) { str_copy(device, dev); - ERR_I(CocCmd((CocConn *)conn, "[device]")); + ERR_I(CocCmd(conn, "[device]")); return(0); OnError: return(-1); } char *TeccGetDev(pTecsClient conn) { - ERR_I(CocCmd((CocConn *)conn, "device")); + ERR_I(CocCmd(conn, "device")); return(device); OnError: return(NULL); } int TeccGet3(pTecsClient conn, float temp[3]) { - ERR_I(CocCmd((CocConn *)conn, "tempC,tempX,tempP")); + ERR_I(CocCmd(conn, "tempC,tempX,tempP")); temp[0]=tempC; temp[1]=tempX; temp[2]=tempP; @@ -53,7 +53,7 @@ int TeccGet(pTecsClient conn, float *temp) { int TeccSet(pTecsClient conn, float temp) { tempC=temp; - ERR_I(CocCmd((CocConn *)conn, "[tempC]")); + ERR_I(CocCmd(conn, "[tempC]")); return(0); OnError: return(-1); } @@ -63,11 +63,11 @@ int TeccSend(pTecsClient conn, char *cmd, char *reply, int replyLen) { int cnt; str_copy(command, cmd); - ERR_I(CocCmd((CocConn *)conn, "[$]")); + ERR_I(CocCmd(conn, "[$]")); cnt=40; util_delay(100); while (cnt>0) { - ERR_I(CocCmd((CocConn *)conn, "$")); + ERR_I(CocCmd(conn, "$")); if (command[0]!='\0') { str_ncpy(reply, command, replyLen); return(0); @@ -82,14 +82,16 @@ int TeccSend(pTecsClient conn, char *cmd, char *reply, int replyLen) { int TeccQuitServer(pTecsClient conn) { quit=1; - ERR_I(CocCmd((CocConn *)conn, "quit")); + ERR_I(CocCmd(conn, "quit")); return(0); OnError: return(-1); } void TeccClose(pTecsClient conn) { - CocCloseClient((CocConn *)conn); - free(conn); + if (conn!=NULL) { + CocCloseClient(conn); + free(conn); + } } #ifdef __VMS @@ -102,7 +104,7 @@ int TeccSetDevVms(pTecsClient conn, char **dev) { strncpy(device, dev[1], l); while (l>0 && device[l-1]==' ') l--; /* trim */ device[l]='\0'; - ERR_I(CocCmd((CocConn *)conn, "[device]")); + ERR_I(CocCmd(conn, "[device]")); return(0); OnError: return(-1); } @@ -110,7 +112,7 @@ int TeccSetDevVms(pTecsClient conn, char **dev) { int TeccGetDevVms(pTecsClient conn, char **dev) { int l, ld; - ERR_I(CocCmd((CocConn *)conn, "device")); + ERR_I(CocCmd(conn, "device")); ld=strlen(device); l=*(short *)dev; if (ld>=l) ld=l; diff --git a/tecs/tecc.h b/tecs/tecc.h index 4fc2fdf4..5e41a672 100644 --- a/tecs/tecc.h +++ b/tecs/tecc.h @@ -6,9 +6,7 @@ ------------------------------------------------------------------------*/ typedef CocConn *pTecsClient; -/* typedef struct { int tecc_private; } *pTecsClient; */ -/* hidden structure for a tecs client -------------------------------------------------------------------------*/ + pTecsClient TeccInit(char *server, int port); /* init tecs client (connect to server) diff --git a/tecs/tecs.c b/tecs/tecs.c index cc18b2d8..1d8f7ce0 100644 --- a/tecs/tecs.c +++ b/tecs/tecs.c @@ -90,7 +90,7 @@ int instCurve(char *nam, char chan) { FILE *fil; int retstat; - logfileOut("install curve %s\n", nam); + logfileOut(LOG_MAIN, "install curve %s\n", nam); retstat=-2; /* errors in following section are severe */ fil=NULL; crv=NULL; @@ -165,10 +165,10 @@ int instCurve(char *nam, char chan) { sprintf(buf, "INTYPE %c:%s;INCRV %c:%d;DISPFLD %d:%c,1;DISPLAY:%d" , chan, intype, chan, num, fld, chan, maxfld); ERR_I(LscCmdChk(ser, buf)); - logfileOut("curve %d on channel %c selected\n", num, chan); + logfileOut(LOG_MAIN, "curve %d on channel %c selected\n", num, chan); } else { /* header does not match -> download */ if (busy) ERR_MSG("busy"); - logfileOut("download curve %d\n", num); + logfileOut(LOG_MAIN, "download curve %d\n", num); sprintf(buf, "INTYPE %c:%s;DISPFLD %d:%c,3;DISPLAY:%d" , chan, intype, fld, chan, maxfld); /* select sensor type first to display sensor units */ ERR_I(LscCmdChk(ser, buf)); @@ -188,7 +188,7 @@ int instCurve(char *nam, char chan) { } while (t!=NULL); sprintf(buf, "CRVHDR %d:%s;INCRV %c:%d;DISPFLD %d:%c,1", num, crv, chan, num, fld, chan); /* write header, select curve */ ERR_I(LscCmdChk(ser, buf)); - logfileOut("curve selected on channel %c\n", chan); + logfileOut(LOG_MAIN, "curve selected on channel %c\n", chan); str_copy(head, crv); str_upcase(head); saveIt=1; @@ -403,7 +403,7 @@ int ReadTemp() { ERR_P(res=SerCmdC(ser, "DIOST?;HTR?;BUSY?;DOUT 3,29")); if (0==strcmp(res, "?TMO")) { - if (0==noResp) logfileOut("no response\n"); + if (0==noResp) logfileOut(LOG_MAIN ,"no response\n"); noResp=1; return(0); } @@ -450,10 +450,14 @@ int ReadTemp() { DlogPut(&dset, tim, 2, t2); DlogUpd(&dset); logTime=(tim/logPeriod+1)*logPeriod; } - if (nP>0 && nX>0 && controlMode==2) { + if (nP>0 && nX>0 && controlMode==2 && tempC!=0) { d=tempH-tempX; d=exp(-d*d); /* if d is small, we are far from setpoint */ if (tInt<60000/period) tInt+=d; /* increase integral time until 60 sec. */ - p=d/tInt; + if (tInt>d) { + p=d/tInt; + } else { + p=1.0; + } tShift=tShift*(1.0-p)+p*(tempX-tempP); ERR_I(SetTemp(0)); } @@ -492,7 +496,7 @@ int ReadTemp() { if (key!=0) { auto_remote_time=tim+600; if (!(dirtyX || dirtyP)) { - logfileOut("user touched keys\n"); + logfileOut(LOG_MAIN ,"user touched keys\n"); } dirtyX=1; dirtyP=1; ERR_P(res=SerCmdC(ser, "MODE?")); @@ -512,10 +516,16 @@ int Settings() { if (dirtyX || dirtyP) { if (busy==0 || dirtyX>=0 && dirtyP>=0) { /* do not enter when busy and dirtyX/P indicates error on last time */ - if (device[0]=='\0') { - logfileOut("configure inputs for codes %d %d\n", codX, codP); + logfileOut(LOG_MAIN ,"configure inputs for "); + if (manualX) { + logfileOut(LOG_MAIN ,"%s ", deviceX); } else { - logfileOut("configure inputs for %s\n", device); + logfileOut(LOG_MAIN ,"%+d ", codX); + } + if (manualP) { + logfileOut(LOG_MAIN ,"%s\n", deviceP); + } else { + logfileOut(LOG_MAIN ,"%+d\n", codP); } if (dirtyP) { sprintf(buf, "DISPFLD 2:%c,1;DISPFLD 4:%c,1", channel[1], channel[3]); @@ -620,12 +630,12 @@ int ExecuteRequest() { if (tim>auto_remote_time || setFlag) ERR_I(Settings()); if (setFlag) { - if (nX>0) { + if (nX>0 && tempC!=0) { tInt=0; /* reset integral time */ ERR_I(SetTemp(1)); - logfileOut("set point\n"); + logfileOut(LOG_MAIN ,"set point\n"); } else { - logfileOut("flag reset\n"); + logfileOut(LOG_MAIN ,"flag reset\n"); } setFlag=0; } @@ -682,14 +692,16 @@ int main(int argc, char *argv[]) char *host; char buf[256], opt; int port, msecTmo; + int logMask; + logMask=LOG_MAIN; binDir=""; logDir=""; serverId="tecs"; host="lnsp26"; port=0; msecTmo=0; - logfileOutTmp("%s ", argv[0]); + logfileOut(LOG_MAIN ,"%s ", argv[0]); for (i=1;i1) { - logfileOut("%d cycles lost\n", tdif-1); + logfileOut(LOG_MAIN ,"%d cycles lost\n", tdif-1); } } - logfileOut("%s got quit command\n", serverId); + logfileOut(LOG_MAIN ,"%s got quit command\n", serverId); DlogClose(&dset); return(1); OnError: diff --git a/test.tcl b/test.tcl index 8682a710..6a5ede69 100644 --- a/test.tcl +++ b/test.tcl @@ -27,7 +27,7 @@ ServerOption ReadUserPasswdTimeout 7000 # time to wiat for a user/passwd to be sent from a client. Increase this # if there is a problem connecting to a server due to network overload\ -ServerOption LogFileDir $shome/sics/log +ServerOption LogFileDir $shome/log #LogFileDir is the directory where the command log is going ServerOption LogFileBaseName $shome/sics/tmp/server