Instantly share code, notes, and snippets.

@dstein64 /printenv.c
Last active Oct 24, 2017

Embed
What would you like to do?
/*** printenv.c ***/
// Description
// printenv - print the environment to stdout
// Synopsis
// printenv
// Build
// $ gcc -o printenv printenv.c
#include <stdio.h>
int main(int argc, char* argv[], char* envp[]) {
for (int i = 0;; ++i) {
char* p = envp[i];
if (p == NULL) break;
printf("%s\n", p);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment