diff options
Diffstat (limited to 'core/import-csv.c')
-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); |