/**
 * Written by Henry Walker
 * Some updates by Janet Davis, August 31, 2006
 * This program plays with environment variables.
 **/

#include <stdio.h>
#include <stdlib.h>

int main( void ) {
  char * str;
  printf( "test of environment variable access by programs\n" );

  // retrieve and print the environment variable PATH 
  str = getenv( "PATH" );
  printf( "The search path for this process is '%s'\n", str );

  // reset the environment variable
  setenv( "PATH", "/home/weinman/public_html/courses/CSC213/2008F/examples/fork", 1 );
  
  // retrieve and print the revised environment variable PATH
  str = getenv( "PATH" );
  printf( "The new search path for this process is '%s'\n", str );

  return 0;
}

