Guest User

Untitled

a guest
Jun 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. /*
  2. * $ gcc -fPIC -shared environ.c -o environ.so && strip environ.so
  3. * or
  4. * $ gcc -DMAIN environ.c
  5. * $ ./a.out
  6. */
  7.  
  8. extern char **environ;
  9.  
  10. char **envp() {
  11. return environ;
  12. }
  13.  
  14. #ifdef MAIN
  15. #include <stdio.h>
  16.  
  17. int main(void)
  18. {
  19. char **env;
  20.  
  21. env = envp();
  22. while (*env)
  23. puts(*env++);
  24.  
  25. return 0;
  26. }
  27. #endif
Add Comment
Please, Sign In to add comment