mirror of
https://github.com/owntracks/recorder.git
synced 2024-11-15 09:58:40 -07:00
FEATURE: ocat --format payload (like RAW, but different)
This commit is contained in:
parent
166ff17085
commit
bcb052bde3
6
ocat.c
6
ocat.c
@ -132,6 +132,7 @@ void usage(char *prog)
|
||||
printf(" geojson\n");
|
||||
printf(" gpx\n");
|
||||
printf(" raw\n");
|
||||
printf(" payload\n");
|
||||
printf(" --fields tst,lat,lon,... Choose fields for CSV. (dflt: ALL)\n");
|
||||
printf(" --last -L JSON object with last users\n");
|
||||
printf(" --killdata requires -u and -d\n");
|
||||
@ -170,6 +171,7 @@ int main(int argc, char **argv)
|
||||
case 'c': otype = CSV; break;
|
||||
case 'g': otype = GEOJSON; break;
|
||||
case 'r': otype = RAW; break;
|
||||
case 'p': otype = RAWPAYLOAD; break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -234,6 +236,8 @@ int main(int argc, char **argv)
|
||||
otype = GEOJSON;
|
||||
else if (!strcmp(optarg, "raw"))
|
||||
otype = RAW;
|
||||
else if (!strcmp(optarg, "payload"))
|
||||
otype = RAWPAYLOAD;
|
||||
else if (!strcmp(optarg, "gpx"))
|
||||
otype = GPX;
|
||||
else if (!strcmp(optarg, "csv"))
|
||||
@ -409,7 +413,7 @@ int main(int argc, char **argv)
|
||||
|
||||
} else if (otype == CSV) {
|
||||
csv_output(obj, CSV, fields);
|
||||
} else if (otype == RAW) {
|
||||
} else if (otype == RAW || otype == RAWPAYLOAD) {
|
||||
/* We've already done what we need to do in locations() */
|
||||
} else if (otype == GEOJSON) {
|
||||
JsonNode *geojson = geo_json(locs);
|
||||
|
@ -525,6 +525,12 @@ static int candidate_line(char *line, void *param)
|
||||
if (otype == RAW) {
|
||||
printf("%s\n", line);
|
||||
return (0);
|
||||
} else if (otype == RAWPAYLOAD) {
|
||||
char *bp;
|
||||
|
||||
if ((bp = strchr(line, '{')) != NULL) {
|
||||
printf("%s\n", bp);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user