From: Steve Sloan Date: Sat, 24 Mar 2012 19:40:16 +0000 (-0700) Subject: Fixed CSV format. X-Git-Url: http://git.itanic.dy.fi/?p=glucose;a=commitdiff_plain;h=0dbd035d171482d3192a0e14073fc1cfeece9e5e Fixed CSV format. --- diff --git a/main.c b/main.c index 954d733..f11ec8f 100644 --- a/main.c +++ b/main.c @@ -71,7 +71,7 @@ int main(int argc, char *argv[]) trace(0, "Done! Reading data\n"); if ( opts.output_format == CSV ) - fprintf(outf, "#,Time,Type,Value,Unit,Before meal,After meal,Stress,Sick,Dont feel right,Activity,Control test\n"); + fprintf(outf, "#,Time,Type,Value,Unit,\"Before meal\",\"After meal\",Stress,Sick,\"Dont feel right\",Activity,\"Control test\"\n"); while (1) { ret = contour_read_entry(fd, usage_code, &msg); @@ -90,7 +90,7 @@ int main(int argc, char *argv[]) token(&tok, '|'); // unknown char *time = token(&tok, '\r'); unit[strlen(unit)-2] = 0; - fprintf(outf, "%s,%.4s-%.2s-%.2s %.2s:%.2s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s\n", + fprintf(outf, "%s,\"%.4s-%.2s-%.2s %.2s:%.2s\",\"%s\",\"%s\",\"%s\",%s,%s,%s,%s,%s,%s,%s\n", seq, &time[0], &time[4], &time[6], &time[8], &time[10], &type[3], val, unit, strchr(notes, 'B') ? "X" : "", strchr(notes, 'A') ? "X" : "", strchr(notes, 'S') ? "X" : "", strchr(notes, 'I') ? "X" : "",