/**
@file environ.c
@author Mitch Richling <http://www.mitchr.me/>
@Copyright Copyright 1994 by Mitch Richling. All rights reserved.
@brief How to use environ@EOL
@Keywords environment unix environ
@Std ISOC
This is an example program intended to illustrate how to
use environ. environ is actually an ISO C construct.
Most UNIX systems allow a third parameter to main() that
is a pointer to environ; however, the ISO C standard
forbids this. Thus, one really should simply use the
global variable environ.
@Tested
- Solaris 2.8
- MacOS X.2
- Linux (RH 7.3)
*/
#include <stdio.h> /* I/O lib ISOC */
#include <stdlib.h> /* Standard Lib ISOC */
extern char **environ;
int main(int argc, char *argv[]);
int main(int argc, char *argv[]) {
char **cp;
printf("Environment:\n");
for(cp=environ; *cp != NULL; cp++)
printf(" %s\n", *cp);
printf("\n");
return 0;
} /* end func main */
Generated by GNU Enscript 1.6.5.2.