main.c
author viric@llimona
Sun, 05 Aug 2007 23:06:42 +0200
changeset 0 7f37716d4f1e
child 5 c87681fff7d3
permissions -rw-r--r--
Initial. Awful makefile.
#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;
}