diff options
author | Anton Lundin <glance@acc.umu.se> | 2013-11-21 23:48:40 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-11-21 15:54:16 -0800 |
commit | 8dde12fa35e0e53f93efef8a99a7fe2e625e901c (patch) | |
tree | cef056e4a8baed9b2ed65005631456e5c2d42f9c /file.c | |
parent | 907a22f37e3acd6c12b2299ad331c3ea81d56f24 (diff) | |
download | subsurface-8dde12fa35e0e53f93efef8a99a7fe2e625e901c.tar.gz |
Add optional support for po2 import from csv files
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -327,20 +327,21 @@ void parse_file(const char *filename, char **error) #define MAXCOLDIGITS 3 #define MAXCOLS 100 -void parse_csv_file(const char *filename, int timef, int depthf, int tempf, char **error) +void parse_csv_file(const char *filename, int timef, int depthf, int tempf, int po2f, char **error) { struct memblock mem; int pnr=0; - char *params[11]; + char *params[13]; char timebuf[MAXCOLDIGITS]; char depthbuf[MAXCOLDIGITS]; char tempbuf[MAXCOLDIGITS]; + char po2buf[MAXCOLDIGITS]; time_t now; struct tm *timep; char curdate[9]; char curtime[6]; - if (timef >= MAXCOLS || depthf >= MAXCOLS || tempf >= MAXCOLS) { + if (timef >= MAXCOLS || depthf >= MAXCOLS || tempf >= MAXCOLS || po2f >= MAXCOLS) { int len = strlen(translate("gettextFromC", "Maximum number of supported columns on CSV import is %d")) + MAXCOLDIGITS; *error = malloc(len); snprintf(*error, len, translate("gettextFromC", "Maximum number of supported columns on CSV import is %d"), MAXCOLS); @@ -350,6 +351,7 @@ void parse_csv_file(const char *filename, int timef, int depthf, int tempf, char snprintf(timebuf, MAXCOLDIGITS, "%d", timef); snprintf(depthbuf, MAXCOLDIGITS, "%d", depthf); snprintf(tempbuf, MAXCOLDIGITS, "%d", tempf); + snprintf(po2buf, MAXCOLDIGITS, "%d", po2f); time(&now); timep = localtime(&now); strftime(curdate, sizeof(curdate), "%Y%m%d", timep); @@ -364,6 +366,8 @@ void parse_csv_file(const char *filename, int timef, int depthf, int tempf, char params[pnr++] = depthbuf; params[pnr++] = "tempField"; params[pnr++] = tempbuf; + params[pnr++] = "po2Field"; + params[pnr++] = po2buf; params[pnr++] = "date"; params[pnr++] = curdate; params[pnr++] = "time"; |