Hi Coders,

I've been considering turning my fuzzy string compare function into a
library.

        /**
         * the fstrcmp function comparse two strings, to determine how
         * simlar two strings appear.
         *
         * @param s1
         *     The first of the strings to compare.
         * @param s2
         *     The second of the strings to compare.
         * @returns
         *     a number between 0.0 and 1.0; 0.0 means the strings are
         *     nothing alike, 1.0 means the two strings are identical.
         */
        double fstrcmp(const char *s1, const char *s2);

I've been using it for something like 15 years, and the side effects are
pretty addictive.

My immediate motivation is that apt-get is driving me crazy.
Wouldn't it be great if when you typed

    apt-get build-deps gcc

instead of saying

    E: Invalid operation build-deps

it said something more useful, like

    E: Invalid operation build-deps, did you mean build-dep instead?

This goes for packages as well.  Wouldn't it be great if

    apt-get install dns-utils

instead of saying

    E: Couldn't find package dns-utils

it said something more useful, like

    E: Couldn't find package dns-utils, did you mean dnsutils instead?


Both of these things are possible with fstrcmp.

fstrcmp would have some interesting friends in the same library,
like
        double fmemcmp(const void *d1, size_t sz1, const void *d2,
        size_t sz2)
and
        double fobjcmp(const void *d1, size_t sz1, const void *d2,
        size_t sz2, int (*cmp)(const void *o1, const void *o2), size_t
        objsize);


There are obvious benefits for compiler error messages, too.  (I have
written compilers using it.)

And think home much better bash could be!

        $ aptget install dnsutils
        bash: aptget: command not found, did you mean apt-get instead?
        $

But first I need fstrcmp in a library.  Do I make a fstrcmp its own
library, or do I contribute it to an existing project and which one?

-- 
Regards
Peter Miller <pmil...@opensource.org.au>
/\/\*        http://www.canb.auug.org.au/~millerp/

PGP public key ID: 1024D/D0EDB64D
fingerprint = AD0A C5DF C426 4F03 5D53  2BDB 18D8 A4E2 D0ED B64D
See http://www.keyserver.net or any PGP keyserver for public key.
_______________________________________________
coders mailing list
coders@slug.org.au
http://lists.slug.org.au/listinfo/coders

Reply via email to