From d23600eb9e2b3348c510ba4a0570d078688426b9 Mon Sep 17 00:00:00 2001 From: Miika Turkia Date: Sun, 7 Jan 2018 14:24:43 +0200 Subject: Add support for air temp on DL7 import Signed-off-by: Miika Turkia --- core/import-csv.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/core/import-csv.c b/core/import-csv.c index 5a687b0bd..1540dd060 100644 --- a/core/import-csv.c +++ b/core/import-csv.c @@ -75,6 +75,7 @@ int parse_dan_format(const char *filename, char **params, int pnr) } while ((end_ptr < mem.size) && (ptr = strstr(mem.buffer + end_ptr, "ZDH"))) { + char *iter_end = NULL; /* * Process the dives, but let the last round be parsed @@ -125,6 +126,23 @@ int parse_dan_format(const char *filename, char **params, int pnr) params[pnr + 5] = strdup(tmpbuf); params[pnr + 6] = NULL; + /* Air temperature */ + memset(tmpbuf, 0, sizeof(tmpbuf)); + iter = strchr(iter, '|'); + + if (iter && iter + 1) { + iter = iter + 1; + iter_end = strchr(iter, '|'); + + if (iter_end) { + memcpy(tmpbuf, iter, iter_end - iter); + params[pnr + 6] = "airTemp"; + params[pnr + 7] = strdup(tmpbuf); + params[pnr + 8] = NULL; + } + } + + /* Search for the next line */ if (iter) iter = strstr(iter, NL); -- cgit v1.2.3-70-g09d2