zdefs.c
author viric@llimona
Sat, 01 Sep 2007 13:04:10 +0200
changeset 20 45798398f4c8
parent 14 a961bb8806b9
permissions -rw-r--r--
Test for http_dec.

#include <stdio.h>
#include "dictre.h"

static void new_word(const char *str)
{
    printf("%s\n", str);
}


void zprocess_def(const char *root, char *def)
{
    int index = 0;
    int res;
    /* Jump the first line (index word) Wait for \n */
    skip_newline(def, &index);
    ++index;

    res = until_newword(def, &index);
    if (res == -1)
        return;

    /* Mark words */
    do {
        int end;
        end = index;
        res = until_noword(def, &end);
        if (res == -1)
            break;
        def[end] = 0;
        insert_word(&def[index], root);
        index = end+1;
        res = until_newword(def,&index);
        if (res == -1)
            break;
    } while (1);
    free(def);
    free(root);
}