Back to index

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

Go to the source code of this file.

Functions

void error (const char *)
void cgihttpsscriptptr_init ()
const char * cgihttpsscriptptr ()

Variables

static char * scriptptr = 0

Function Documentation

const char* cgihttpsscriptptr ( )

Definition at line 30 of file cgihttpsscriptptr.c.

{
       if (!scriptptr)
       {
       char   *p=getenv("SCRIPT_NAME");
       char   *h=getenv("HTTP_HOST");
       char   *q;

              if (!h)       h="";
              if (!p)       p="";

              q=malloc(strlen(p)+strlen(h)+sizeof("https://"));
              if (!q)       error("Out of memory.");
              sprintf(q, "https:%s%s%s", (*h ? "//":""), h, p);
              scriptptr=q;
       }
       return (scriptptr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 21 of file cgihttpsscriptptr.c.

{
       /* Reinitialisation required when running as fastcgi */ 
       if (scriptptr) {
              free(scriptptr);
              scriptptr=0;
       }
}
void error ( const char *  )

Definition at line 23 of file showmsg2html.c.

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

Variable Documentation

char* scriptptr = 0 [static]

Definition at line 18 of file cgihttpsscriptptr.c.