/**
* print environment
*
**/
#include <stdio.h>ide
extern char **environ;server
int main()
{
char **var;
for (var = environ; *var != NULL; var++)
printf("%s \n", *var);
return 0;
}
get
File Edit Options Buffers Tools C Hide/Show Help
/**
* getenv
*
**/it
#include <stdlib.h>
#include <stdio.h>io
int main()
{
char *server_name = getenv("SERVER_NAME");
if (server_name == NULL)
server_name = "default server name";
printf("client accessing '%s' \n", server_name);
return 0;
}
cli
#include <unistd.h>
#include <stdio.h>di
int main()
{
char *envp[] = {
"SERVER_NAME=my.server.name",
NULL,};
int ret = execle("client", "client", NULL, envp);
return 0;
}vi