Attached is a toy program to illustrate the new POPT_ARG_BITSET API in popt.

The toy program uses /usr/share/dict/words as a attribute
universe, and checks arguments to see if they are in the
attribute dictionary.

Here's some usage examples

        $ wc -l /usr/share/dict/words
        479827 /usr/share/dict/words
        $ ./tdict @@@@ XyZZy
        ===== No words are in /usr/share/dict/words
        @@@@:   NO
        XyZZy:  NO
        $ ./tdict foo bar baz @@@@ XyZZy
        ===== Some words are in /usr/share/dict/words
        foo:    YES
        bar:    YES
        baz:    YES
        @@@@:   NO
        XyZZy:  NO
===== poptBits N:959654 M:1439481 K:2 (176Kb) total(5) = hits(3) + misses(2)
        $

The API doesn't look too bad imho. Other opinions?

Choosing a reasonably sane default for the Bloom filter's N/M/K
parameters in popt will still need some adjustment.

73 de Jeff

Attachment: tdict.c
Description: Binary data


Reply via email to