main.c
changeset 0 7f37716d4f1e
child 5 c87681fff7d3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.c	Sun Aug 05 23:06:42 2007 +0200
@@ -0,0 +1,57 @@
+#include <stdio.h>
+
+#include "dictre.h"
+
+extern int nwords;
+extern int ndefs;
+
+int main(int argn, char **argv)
+{
+    char tmpname[500];
+    FILE *i, *d;
+
+    if (argn < 4)
+    {
+        fprintf(stderr, "usage: %s <dict_basename> "
+                "<dict_basename_out> <filter>\n",
+                argv[0]);
+        return 1;
+    }
+    strcpy(tmpname, argv[1]);
+    strcat(tmpname, ".index");
+    i = fopen(tmpname, "r");
+    if(i == NULL)
+    {
+        fprintf(stderr, "File: %s ", tmpname);
+        perror("- cannot open file.");
+        exit(-1);
+    }
+
+    strcpy(tmpname, argv[1]);
+    strcat(tmpname, ".dict");
+    d = fopen(tmpname, "r");
+    if(d == NULL)
+    {
+        fprintf(stderr, "File: %s ", tmpname);
+        perror("- cannot open file.");
+        exit(-1);
+    }
+
+    load_init();
+
+    load_dictionary(i, d);
+
+    fclose(i);
+    fclose(d);
+
+    sort_words();
+
+    if (0)
+        print_words();
+
+    filter_all(argv[3]);
+
+    write_dictionary(argv[2]);
+
+    return 0;
+}