lib/portimpl.c File Reference

#include "common.h"
#include "htmshell.h"
#include "portable.h"
#include "obscure.h"
#include "portimpl.h"
#include <dirent.h>

Include dependency graph for portimpl.c:

Go to the source code of this file.

Functions

static void setupWss ()
void makeTempName (struct tempName *tn, char *base, char *suffix)
char * cgiDir ()
char * trashDir ()
double machineSpeed ()
void envUpdate (char *name, char *value)
void mkdirTrashDirectory (char *prefix)

Variables

static char const rcsid [] = "$Id: portimpl.c,v 1.14 2006/06/23 21:44:04 hiram Exp $"
static struct webServerSpecificwss = NULL


Function Documentation

char* cgiDir (  ) 

Definition at line 56 of file portimpl.c.

References webServerSpecific::cgiDir, setupWss(), and wss.

00057 {
00058 setupWss();
00059 return wss->cgiDir();
00060 }

Here is the call graph for this function:

void envUpdate ( char *  name,
char *  value 
)

Definition at line 76 of file portimpl.c.

References needMem(), and safef().

Referenced by initCgiInput().

00078 {
00079 int size = strlen(name) + strlen(value) + 2;
00080 char *s = needMem(size);
00081 safef(s, size, "%s=%s", name, value);
00082 putenv(s);
00083 }

Here is the call graph for this function:

Here is the caller graph for this function:

double machineSpeed (  ) 

Definition at line 69 of file portimpl.c.

References setupWss(), webServerSpecific::speed, and wss.

00071 {
00072 setupWss();
00073 return wss->speed();
00074 }

Here is the call graph for this function:

void makeTempName ( struct tempName tn,
char *  base,
char *  suffix 
)

Definition at line 49 of file portimpl.c.

References webServerSpecific::makeTempName, setupWss(), and wss.

Referenced by parseMultiParts(), xenAlignBig(), and xenAlignWorm().

00051 {
00052 setupWss();
00053 wss->makeTempName(tn,base,suffix);
00054 }

Here is the call graph for this function:

Here is the caller graph for this function:

void mkdirTrashDirectory ( char *  prefix  ) 

Definition at line 85 of file portimpl.c.

References errnoAbort(), safef(), and trashDir().

00087 {
00088 struct stat buf;
00089 char trashDirName[128];
00090 safef(trashDirName, sizeof(trashDirName), "%s/%s", trashDir(), prefix);
00091 if (stat(trashDirName,&buf))
00092     {
00093     int result = mkdir (trashDirName, S_IRWXU | S_IRWXG | S_IRWXO);
00094     if (0 != result)
00095         errnoAbort("failed to create directory %s", trashDirName);
00096     }
00097 }

Here is the call graph for this function:

static void setupWss (  )  [static]

Definition at line 18 of file portimpl.c.

References endsWith(), webServerSpecific::name, sameWord, wss, wssBrcMcw, wssCommandLine, wssDefault, wssLinux, wssMicrosoftII, and wssMicrosoftPWS.

Referenced by cgiDir(), machineSpeed(), makeTempName(), and trashDir().

00019 {
00020 if (wss == NULL)
00021     {
00022     char *s = getenv("SERVER_SOFTWARE");
00023     wss = &wssDefault;
00024     if (s == NULL)
00025         {
00026         wss = &wssCommandLine;
00027         }
00028     else
00029         {
00030         if (strncmp(wssMicrosoftII.name, s, strlen(wssMicrosoftII.name)) == 0)
00031             wss = &wssMicrosoftII;
00032         else if (strncmp(wssMicrosoftPWS.name, s, strlen(wssMicrosoftPWS.name)) == 0)
00033             wss = &wssMicrosoftPWS;
00034         else 
00035             {
00036             char *t = getenv("HTTP_HOST");
00037             if (t != NULL)
00038                 {
00039                 if (sameWord(t, "Crunx"))
00040                     wss = &wssLinux;
00041                 else if (endsWith(t, "brc.mcw.edu"))
00042                     wss = &wssBrcMcw;
00043                 }
00044             }
00045         }
00046     }
00047 }

Here is the call graph for this function:

Here is the caller graph for this function:

char* trashDir (  ) 

Definition at line 62 of file portimpl.c.

References setupWss(), webServerSpecific::trashDir, and wss.

Referenced by mkdirTrashDirectory().

00064 {
00065 setupWss();
00066 return wss->trashDir();
00067 }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

char const rcsid[] = "$Id: portimpl.c,v 1.14 2006/06/23 21:44:04 hiram Exp $" [static]

Definition at line 14 of file portimpl.c.

struct webServerSpecific* wss = NULL [static]

Definition at line 16 of file portimpl.c.

Referenced by cgiDir(), machineSpeed(), makeTempName(), setupWss(), and trashDir().


Generated on Tue Dec 25 20:10:19 2007 for blat by  doxygen 1.5.2