Back to index

courier  0.68.2
Classes | Functions | Variables
args.c File Reference
#include "sqwebmail.h"
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

Go to the source code of this file.

Classes

struct  arglist

Functions

void freeargs ()
void addarg (const char *p)
const char * getarg (const char *n)

Variables

static struct arglistarglist = 0

Class Documentation

struct arglist

Definition at line 15 of file args.c.

Collaboration diagram for arglist:
Class Members
char * argbuf
struct arglist * next

Function Documentation

void addarg ( const char *  p)

Definition at line 34 of file args.c.

{
       char *s=strdup(p);
       struct arglist *a;

       if (!s)
              enomem();

       a=(struct arglist *)malloc(sizeof(struct arglist));

       if (!a)
       {
              free(s);
              enomem();
       }

       a->next=arglist;
       arglist=a;
       a->argbuf=s;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void freeargs ( )

Definition at line 22 of file args.c.

{
       struct arglist *a;

       while ((a=arglist) != NULL)
       {
              arglist=a->next;
              free(a->argbuf);
              free(a);
       }
}

Here is the caller graph for this function:

const char* getarg ( const char *  n)

Definition at line 55 of file args.c.

{
       size_t l=strlen(n);
       struct arglist *a;

       for (a=arglist; a; a=a->next)
              if (strncmp(a->argbuf, n, l) == 0 &&
                  a->argbuf[l] == '=')
                     return (a->argbuf+l+1);
       return ("");
}

Variable Documentation

struct arglist* arglist = 0 [static]

Definition at line 20 of file args.c.