Re: [PARPORT] Questions and first pass at ieee1284 MODULE_DEVICE_TABLE support

From: Joerg Schilling (
Date: Thu Dec 14 2000 - 14:08:46 EST

  • Next message: stef: "[PARPORT] epat c7 reset sequence"

    >From: "Adam J. Richter" <>

    > The matching problem is not to test a lot of text against one pattern, but
    >rather to test a number of patterns against one string of text. So, compiling
    >the patterns is unlikely to be the appropriate solution. I think that some simple
    >thing that uses strstr will suffice. We'll see. Thanks for your input anyway.

    Quite simple:

    #define MAXPAT 64

    BOOL domatch(pattern, string)
            char *pattern;
            char *string;
            char *p;
            int plen;
            int alt;
            int aux[MAXPAT];
            int state[MAXPAT+1];

            plen = strlen(pattern);
            if (plen > MAXPAT)
                    return (FALSE);

            alt = patcompile(pattern, plen, aux);
            if (alt == 0)
                    return (FALSE);

            p = patmatch(pattern, aux, string, 0, strlen(string), alt, state);
            if (p == NULL)
                    return (FALSE);
            return *p == 0;

    Jörg (home) Jörg Schilling D-13353 Berlin
  (uni) If you don't have iso-8859-1
  (work) chars I am J"org Schilling

    -- To unsubscribe, send mail to: --
    -- with the single word "unsubscribe" in the body of the message. --

    This archive was generated by hypermail 2b29 : Thu Dec 14 2000 - 14:11:09 EST