This commit is contained in:
cvs
2003-03-12 13:41:03 +00:00
parent 0dea907a42
commit 9f03f7cdd7
2 changed files with 20 additions and 26 deletions

View File

@@ -170,6 +170,7 @@ static char
alarmChannels[N_SENSORS],
alarmHistory[N_SENSORS],
dev[80],
dev2[80],
devHelp[10000],
controlChannel[4]="A";
@@ -490,19 +491,25 @@ int InstalCurve(SensorT *sensor, char *dev) {
return -1;
}
int ReadTable(void) {
char nbuf[256];
if (table!=NULL && tim>tableTime+60) { FREE(table); table=NULL; }; /* clear old table */
if (table!=NULL) return 0;
str_copy(nbuf, binDir);
str_append(nbuf, TABLE_FILE);
ERR_P(table=str_read_file(nbuf));
tableTime=tim;
return 1;
OnError: return -1;
}
int PrepInput(char *label) {
char *t, *e;
char nam[16], chans[8], nbuf[256], typ;
char nam[16], chans[8], typ;
int i, j, l;
SensorT *s;
if (table!=NULL && tim>tableTime+60) { FREE(table); table=NULL; }; /* clear old table */
if (table==NULL) { /* read table */
str_copy(nbuf, binDir);
str_append(nbuf, TABLE_FILE);
ERR_P(table=str_read_file(nbuf));
tableTime=tim;
}
ERR_I(ReadTable());
t=strstr(table, label);
if (t==NULL) ERR_MSG("device not found");
e=strchr(t, '\'');
@@ -2086,17 +2093,11 @@ EndStatus:
int DevHelpHdl(int mode, void *base, int fd) {
char *t, *n, *d, *en, *ed;
char line[80], nbuf[256];
int l;
int l, iret;
static int doit=1;
if (table!=NULL && tim>tableTime+60) { FREE(table); table=NULL; }; /* clear old table */
if (table==NULL) { /* read table */
str_copy(nbuf, binDir);
str_append(nbuf, TABLE_FILE);
ERR_P(table=str_read_file(nbuf));
tableTime=tim;
doit=1;
}
ERR_I(iret=ReadTable());
if (iret) doit=1;
if (doit) {
doit=0;
t=table;
@@ -2338,6 +2339,7 @@ int main(int argc, char *argv[]) {
CocDefStr(pid, RD); CocHdl(PidSumHdl);
CocDefStr(config, RD);
CocDefStr(dev, RD);
CocDefStr(dev2, RD);
CocDefStr(devHelp, RD); CocHdl(DevHelpHdl);
CocDefInt(cod1, RD);