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

From: Joerg Schilling (schilling@fokus.gmd.de)
Date: Thu Dec 14 2000 - 14:08:46 EST

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

    >From: "Adam J. Richter" <adam@yggdrasil.com>

    > 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

     EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
           js@cs.tu-berlin.de (uni) If you don't have iso-8859-1
           schilling@fokus.gmd.de (work) chars I am J"org Schilling
     URL: http://www.fokus.gmd.de/usr/schilling ftp://ftp.fokus.gmd.de/pub/unix

    -- To unsubscribe, send mail to: linux-parport-request@torque.net --
    -- 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