- more AsconStatus states

- enhancements in binprot
- make Logger public (logger.h)
- added lscprot (50 ms write delay for lakeshore models)
- additonal bug fixes
This commit is contained in:
2016-05-13 16:32:18 +02:00
parent e476d19040
commit fdb443441a
10 changed files with 169 additions and 28 deletions

View File

@@ -15,18 +15,6 @@ Markus Zolliker, Sept 2004
#include <ctype.h>
#include "logger.h"
struct Logger {
char *name;
char *old;
int oldsize;
int period;
time_t last, lastWrite, omitTime;
int numeric;
float omitValue;
int exact;
Logger *next;
};
static char *dir = NULL;
static Logger *list;
static time_t lastLife = 0;
@@ -152,6 +140,7 @@ int LoggerWrite0(Logger * log, time_t now, int period, char *value)
int l, ext, writeInfo;
FILE *fil;
time_t beforenow;
char *nl;
if (log->name[0] == '\0')
return 0;
@@ -211,7 +200,13 @@ int LoggerWrite0(Logger * log, time_t now, int period, char *value)
}
}
strftime(stim, sizeof stim, "%H:%M:%S", &tm);
fprintf(fil, "%s\t%s\n", stim, value);
nl = strchr(value, '\n');
if (nl == NULL) {
fprintf(fil, "%s\t%s\n", stim, value);
} else {
/* newline within string! do write only characters before nl */
fprintf(fil, "%s\t%.*s\n", stim, (nl - value), value);
}
log->lastWrite = now;
fclose(fil);