/* * Low level acces to the environment space */ #include #include #include int main(int argc, char *argv[], char *envp[]) { char *ptr, *clone, *tok; int foo = 0; while ( NULL != (ptr=envp[foo]) ) { printf("%4d %s\n", foo, ptr); clone = strdup(ptr); tok = strtok(clone, "="); printf(" key : %s\n", tok); tok = strtok(NULL, "="); printf(" value : %s\n", tok); free(clone); foo++; } return 0; }