Back to index

courier  0.68.2
Functions | Variables
cgethostname.c File Reference
#include "courier.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Functions

int gethostname (const char *, size_t)
const char * config_gethostname ()

Variables

static char * hostname_buf = 0

Function Documentation

const char* config_gethostname ( )

Definition at line 24 of file cgethostname.c.

{
char   buf[BUFSIZ];

       if (!hostname_buf)
       {
              buf[sizeof(buf)-1]=0;
              buf[0]=0;
              gethostname(buf, sizeof(buf)-1);
              if (buf[0])
              {
                     hostname_buf=courier_malloc(strlen(buf)+1);
                     strcpy(hostname_buf, buf);
              }
       }
       return (hostname_buf ? hostname_buf:"");
}

Here is the call graph for this function:

Here is the caller graph for this function:

int gethostname ( const char *  ,
size_t   
)

Here is the caller graph for this function:


Variable Documentation

char* hostname_buf = 0 [static]

Definition at line 22 of file cgethostname.c.