Back to index

wims  3.65+svn20090927
Functions
setenv.c File Reference
#include "../config.h"
#include <stdlib.h>
#include <stdio.h>

Go to the source code of this file.

Functions

void * xmalloc (size_t n)
int setenv (const char *name, const char *value, int overwrite)
void unsetenv (const char *name)

Function Documentation

int setenv ( const char *  name,
const char *  value,
int  overwrite 
)

Definition at line 7 of file setenv.c.

{
  char *s;
  if (!overwrite && getenv(name)) return 0;
  s = xmalloc(2 + strlen(name) + strlen(value));
  sprintf(s, "%s=%s", name,value);
  return putenv(s);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unsetenv ( const char *  name)

Definition at line 17 of file setenv.c.

{ setenv(name,"",1); }

Here is the call graph for this function:

Here is the caller graph for this function:

void* xmalloc ( size_t  n)

Definition at line 3 of file xmalloc.c.

{
    void *p = malloc(n);
    if(p==NULL) {
        fprintf(stderr,"Malloc failure."); exit(1);
    }
    return p;
}

Here is the caller graph for this function: