- remob.c: forward errors to sics correctly
- minor, more cosmetic fixes
This commit is contained in:
29
logreader.c
29
logreader.c
@ -218,9 +218,7 @@ static int LogReader(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
int argc, char *argv[])
|
||||
{
|
||||
/* Usage:
|
||||
graph <start time> <end time> [ none <none value> ] np <number of points> <variable> [<variable> ...]
|
||||
graph <start time> <end time> text <variable>
|
||||
graph <start time> <end time> <step> <variable> [<variable> ...]
|
||||
graph <start time> <end time> [ none <none value> | text | np <number of points> ] <variable> [<variable> ...]
|
||||
|
||||
<start time> and <end time> are seconds since epoch (unix time) or, if the value
|
||||
is below one day, a time relative to the actual time
|
||||
@ -230,15 +228,13 @@ static int LogReader(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
<number of points> is the maximal number of points to be returned. If more values
|
||||
are present and the values are numeric, the data is reduced. If the data is not
|
||||
numeric, the last values may be skipped in order to avoid overflow.
|
||||
If np is not given, it is assumed to be very high.
|
||||
|
||||
<variable> is the name of a variable (several vaiables may be given).
|
||||
Note that slashes are converted to dots, and that the first slash is ignored.
|
||||
|
||||
The seconds variant is for text values, which can not be reduced. In any case, all values
|
||||
are returned.
|
||||
|
||||
The third variant is old style and can be replaced by the first variant, where
|
||||
<number of points> = (<start time> - <end time>) / <step> + 2
|
||||
"text" means that the values are not numeric, in this case np is not needed
|
||||
and by default infinitely high
|
||||
|
||||
|
||||
Output format:
|
||||
@ -308,15 +304,16 @@ Statistics *old;
|
||||
to += now;
|
||||
}
|
||||
iarg = 3;
|
||||
type0 = NUMERIC;
|
||||
while (1) {
|
||||
if (iarg >= argc)
|
||||
goto illarg;
|
||||
if (strcasecmp(argv[iarg], "text") == 0) { /* non-numeric values */
|
||||
iarg++;
|
||||
step = 1;
|
||||
type0 = TEXT;
|
||||
np = to - from + 2;
|
||||
break;
|
||||
type0 = TEXT;
|
||||
/* break; */
|
||||
} else if (strcasecmp(argv[iarg], "none") == 0) { /* none */
|
||||
iarg++;
|
||||
if (iarg >= argc)
|
||||
@ -327,7 +324,6 @@ Statistics *old;
|
||||
iarg++;
|
||||
if (iarg >= argc)
|
||||
goto illarg;
|
||||
type0 = NUMERIC;
|
||||
np = strtol(argv[iarg], &p, 0);
|
||||
if (p == argv[iarg])
|
||||
goto illarg;
|
||||
@ -341,14 +337,9 @@ Statistics *old;
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
step = strtol(argv[iarg], &p, 0);
|
||||
if (p == argv[iarg])
|
||||
goto illarg;
|
||||
iarg++;
|
||||
if (step <= 0)
|
||||
step = 1;
|
||||
type0 = NUMERIC;
|
||||
np = (from - to) / step + 2;
|
||||
np = to - from + 2;
|
||||
step = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (step <= 0)
|
||||
|
Reference in New Issue
Block a user