Skip to content

Instantly share code, notes, and snippets.

@trapd00r
Created May 13, 2011 13:06
Show Gist options
  • Save trapd00r/970500 to your computer and use it in GitHub Desktop.
Save trapd00r/970500 to your computer and use it in GitHub Desktop.
getenv
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
static const char *env[] = {
"HOME",
"XDG_CACHE_HOME", "XDG_CONFIG_HOME", "XDG_DATA_HOME",
"BIN_HOME", "DEVEL_HOME",
};
int i = 0;
while(env[i] != NULL) {
printf("%20.20s: %s\n", env[i], getenv( env[i] ));
i++;
}
return 0;
}
/* vim: set ts=2 expandtab sw=2: */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment