summaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2014-02-15 10:51:23 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-02-15 06:33:33 -0800
commitcb5ab4bc8e192e65dded3bc3f3bfb703441e5436 (patch)
treea115e650a96881748c8ccdd60f62e3a01e0b322f /file.c
parent31aa93857a794078c6a43e4a5b9808a95f13a04e (diff)
downloadsubsurface-cb5ab4bc8e192e65dded3bc3f3bfb703441e5436.tar.gz
Add unit support for CSV import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'file.c')
-rw-r--r--file.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/file.c b/file.c
index 08b61b234..01c519e17 100644
--- a/file.c
+++ b/file.c
@@ -385,17 +385,18 @@ 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, int po2f, int cnsf, int stopdepthf, int sepidx, const char *csvtemplate, char **error)
+void parse_csv_file(const char *filename, int timef, int depthf, int tempf, int po2f, int cnsf, int stopdepthf, int sepidx, const char *csvtemplate, int unitidx, char **error)
{
struct memblock mem;
int pnr=0;
- char *params[19];
+ char *params[21];
char timebuf[MAXCOLDIGITS];
char depthbuf[MAXCOLDIGITS];
char tempbuf[MAXCOLDIGITS];
char po2buf[MAXCOLDIGITS];
char cnsbuf[MAXCOLDIGITS];
char stopdepthbuf[MAXCOLDIGITS];
+ char unitbuf[MAXCOLDIGITS];
char separator_index[MAXCOLDIGITS];
time_t now;
struct tm *timep;
@@ -416,6 +417,7 @@ void parse_csv_file(const char *filename, int timef, int depthf, int tempf, int
snprintf(cnsbuf, MAXCOLDIGITS, "%d", cnsf);
snprintf(stopdepthbuf, MAXCOLDIGITS, "%d", stopdepthf);
snprintf(separator_index, MAXCOLDIGITS, "%d", sepidx);
+ snprintf(unitbuf, MAXCOLDIGITS, "%d", unitidx);
time(&now);
timep = localtime(&now);
strftime(curdate, sizeof(curdate), "%Y%m%d", timep);
@@ -440,6 +442,8 @@ void parse_csv_file(const char *filename, int timef, int depthf, int tempf, int
params[pnr++] = curdate;
params[pnr++] = "time";
params[pnr++] = curtime;
+ params[pnr++] = "units";
+ params[pnr++] = unitbuf;
params[pnr++] = "separatorIndex";
params[pnr++] = separator_index;
params[pnr++] = NULL;