aboutsummaryrefslogtreecommitdiffstats
path: root/core/file.c
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2017-09-06 19:32:04 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-09-11 07:21:43 -0700
commit40cc0b0e4bacde90c296472c687cf0bef603fd66 (patch)
treedbe9e54de7d506355f0a94058aa37e8628b03ed6 /core/file.c
parent5b5cab2905aea4d97e3c6d6aa13455d63faf975c (diff)
downloadsubsurface-40cc0b0e4bacde90c296472c687cf0bef603fd66.tar.gz
Import dive number from DL7 log
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Diffstat (limited to 'core/file.c')
-rw-r--r--core/file.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/core/file.c b/core/file.c
index dddc77826..c90d394aa 100644
--- a/core/file.c
+++ b/core/file.c
@@ -911,6 +911,15 @@ int parse_dan_format(const char *filename, char **params, int pnr)
mem_csv.buffer = malloc(mem.size + 1);
mem_csv.size = mem.size;
+ iter = ptr + 4;
+ iter = strchr(iter, '|');
+ if (iter) {
+ memcpy(tmpbuf, ptr + 4, iter - ptr - 4);
+ tmpbuf[iter - ptr - 4] = 0;
+ params[pnr] = "diveNro";
+ params[pnr + 1] = strdup(tmpbuf);
+ }
+
//fprintf(stderr, "DEBUG: BEGIN end_ptr %d round %d <%s>\n", end_ptr, j++, ptr);
iter = ptr + 1;
for (i = 0; i <= 4 && iter; ++i) {
@@ -922,8 +931,8 @@ int parse_dan_format(const char *filename, char **params, int pnr)
/* Setting date */
memcpy(tmpbuf, iter, 8);
tmpbuf[8] = 0;
- params[pnr] = "date";
- params[pnr + 1] = strdup(tmpbuf);
+ params[pnr + 2] = "date";
+ params[pnr + 3] = strdup(tmpbuf);
/* Setting time, gotta prepend it with 1 to
* avoid octal parsing (this is stripped out in
@@ -931,9 +940,9 @@ int parse_dan_format(const char *filename, char **params, int pnr)
tmpbuf[0] = '1';
memcpy(tmpbuf + 1, iter + 8, 6);
tmpbuf[7] = 0;
- params[pnr + 2] = "time";
- params[pnr + 3] = strdup(tmpbuf);
- params[pnr + 4] = NULL;
+ params[pnr + 4] = "time";
+ params[pnr + 5] = strdup(tmpbuf);
+ params[pnr + 6] = NULL;
ptr = strstr(ptr, "ZDP{");
if (ptr)