Back to index

courier  0.68.2
Functions | Variables
cfilename.c File Reference
#include "courier.h"
#include "sysconfdir.h"
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

Go to the source code of this file.

Functions

char * config_localfilename (const char *p)
int config_has_vhost (const char *p)
void config_set_local_vhost (const char *p)
const char * config_get_local_vhost ()

Variables

static const char * local_vhost = 0

Function Documentation

const char* config_get_local_vhost ( )

Definition at line 52 of file cfilename.c.

{
       return local_vhost;
}

Here is the caller graph for this function:

int config_has_vhost ( const char *  p)

Definition at line 35 of file cfilename.c.

{
       char   *filename
              =courier_malloc(sizeof(SYSCONFDIR "/vhost.")+strlen(p));
       int exists;

       strcat(strcpy(filename, SYSCONFDIR "/vhost."), p);
       exists=access(filename, 0) == 0;
       free(filename);
       return exists;
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* config_localfilename ( const char *  p)

Definition at line 15 of file cfilename.c.

{
       char   *c=courier_malloc(sizeof(SYSCONFDIR "/")+strlen(p)
                              + (local_vhost ? strlen(local_vhost)+2:0));

       char   *fn=strcat(strcpy(c, SYSCONFDIR "/"), p);

       if (local_vhost)
       {
              size_t l=strlen(fn);

              strcat(strcat(fn, "."), local_vhost);

              if (access(fn, 0) == 0)
                     return fn;
              fn[l]=0;
       }
       return fn;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void config_set_local_vhost ( const char *  p)

Definition at line 47 of file cfilename.c.

{
       local_vhost=p;
}

Here is the caller graph for this function:


Variable Documentation

const char* local_vhost = 0 [static]

Definition at line 13 of file cfilename.c.