diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -41,7 +41,7 @@ create_node(RAD_LIST *hdr, RAD_LIST *descr) for (i = list_count(hdr)-1; i >= 0; i--) { struct header *dp = list_item(hdr, i); - if (!dp->pos) { + if (dp->pos < 0) { if (prev) dp->pos = prev->pos; else { @@ -53,7 +53,7 @@ create_node(RAD_LIST *hdr, RAD_LIST *descr) error_count++; } } - if (dp->pos) + if (dp->pos >= 0) prev = dp; } node->header = hdr; @@ -79,10 +79,10 @@ _emit_headers(void *item, void *data) fprintf(stderr, "Emitting %s\n", hp->key); sound = greek_to_transcription(hp->key); if (hp->forms) - sql_query("INSERT INTO dict VALUES(%lu,\"%s\",\"%s\",\"%s\",\"%s\")", + sql_query("INSERT INTO dict VALUES(%lu,\"%s\",\"%s\",%d,\"%s\")", dict_index, hp->key, sound, hp->pos, hp->forms); else - sql_query("INSERT INTO dict (ident,word,sound,pos) VALUES(%lu,\"%s\",\"%s\",\"%s\")", + sql_query("INSERT INTO dict (ident,word,sound,pos) VALUES(%lu,\"%s\",\"%s\",%d)", dict_index, hp->key, sound, hp->pos); efree(sound); return 0; @@ -273,6 +273,7 @@ main(int argc, char **argv) make_m4_args (m4_bin, include_list); node_list = list_create(); + sql_connect(); argc -= optind; argv += optind; @@ -282,8 +283,6 @@ main(int argc, char **argv) if (compile_only) return 0; - sql_connect(); - antonym_list = list_create(); xref_list = list_create(); |