Skip to content

Instantly share code, notes, and snippets.

@fd00
Created September 30, 2012 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fd00/3806794 to your computer and use it in GitHub Desktop.
Save fd00/3806794 to your computer and use it in GitHub Desktop.
csv2json-0.1-1bl1.src.patch
--- origsrc/csv2json/process.c 2011-12-16 01:24:33.000000000 +0900
+++ src/csv2json/process.c 2012-09-25 08:20:48.875314100 +0900
@@ -13,6 +13,7 @@ int process(FILE *file, char *sep) {
char *p = buf;
list *l = NULL;
+ printf("[");
while((p = fgets(buf, BUFLEN, file)) != NULL) {
if(first) {
first = 0;
@@ -29,6 +30,7 @@ int process(FILE *file, char *sep) {
count++;
}
}
+ printf("]");
if(l != NULL) {
freeList(l);
@@ -51,7 +53,7 @@ static int printRec(char *rec, char *sep
while((q = (char *)strtok(p, sep)) != NULL) {
p = NULL;
stripNewline(q);
- printf("%s: \"%s\"", getList(l), q);
+ printf("\"%s\": \"%s\"", getList(l), q);
count++;
if(count < collength)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment