diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2018-01-07 14:24:43 +0200 |
---|---|---|
committer | mturkia <miika.turkia@gmail.com> | 2018-01-08 06:06:12 +0200 |
commit | d23600eb9e2b3348c510ba4a0570d078688426b9 (patch) | |
tree | 6fba9eadc5495b8bec0925c8e4551167eada9aab /core | |
parent | 65c4891a71866bbd25066c54deae5fd4a0b07d7e (diff) | |
download | subsurface-d23600eb9e2b3348c510ba4a0570d078688426b9.tar.gz |
Add support for air temp on DL7 import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/import-csv.c | 18 |
1 files changed, 18 insertions, 0 deletions
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); |