/* Collection of code snippets by Arne Vajhøj */
/* (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) */
#include <stdio.h>
#include <string.h>

void test(char *s)
{
    char from[256],to[256],msg[256],*p1,*p2;
    if(strstr(s,"PRIVMSG"))
    {
        p1 = strchr(s,'!');
        strncpy(from,s,p1-s);
        from[p1-s] = '\0';
        p2 = strstr(p1+1,"PRIVMSG ");
        strncpy(to,p1+1,p2-p1-1);
        to[p2-p1-1] = '\0';
        strcpy(msg,p2+8);
        printf("<%s -> %s>  %s\r\n", from, to, msg);
    }
}

int main()
{
   test("XXX!YYYPRIVMSG Dette er en test");
   return 0;
}
