Back to index

courier  0.68.2
Functions
cgiuseragent.c File Reference
#include "cgi.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>

Go to the source code of this file.

Functions

void error (const char *)
int cgi_useragent (const char *p)

Function Documentation

int cgi_useragent ( const char *  p)

Definition at line 17 of file cgiuseragent.c.

{
       const char *c=getenv("HTTP_USER_AGENT");

       for ( ; c && *c; c++)
       {
              size_t i;

              if (isalpha((int)(unsigned char)*c))
                     continue;

              for (i=0; p[i]; i++)
              {
                     int a,b;

                     a=(unsigned char)p[i];
                     b=(unsigned char)c[i+1];
                     if (!b)
                            break;

                     a=toupper(a);
                     b=toupper(b);
                     if (a != b)
                            break;
              }

              if (p[i] == 0)
              {
                     int b=(unsigned char)c[i+2];

                     if (b == 0 || !isalpha(b))
                            return (1);
              }
       }
       return (0);
}

Here is the caller graph for this function:

void error ( const char *  )

Definition at line 23 of file showmsg2html.c.

{
       fprintf(stderr, "%s\n", p);
       exit(1);
}