env.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /* Copyright (c) 2003-2004, Roger Dingledine
  2. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
  3. * Copyright (c) 2007-2018, The Tor Project, Inc. */
  4. /* See LICENSE for licensing information */
  5. #ifndef TOR_ENV_H
  6. #define TOR_ENV_H
  7. char **get_environment(void);
  8. struct smartlist_t;
  9. int environment_variable_names_equal(const char *s1, const char *s2);
  10. /* DOCDOC process_environment_t */
  11. typedef struct process_environment_t {
  12. /** A pointer to a sorted empty-string-terminated sequence of
  13. * NUL-terminated strings of the form "NAME=VALUE". */
  14. char *windows_environment_block;
  15. /** A pointer to a NULL-terminated array of pointers to
  16. * NUL-terminated strings of the form "NAME=VALUE". */
  17. char **unixoid_environment_block;
  18. } process_environment_t;
  19. process_environment_t *process_environment_make(struct smartlist_t *env_vars);
  20. void process_environment_free_(process_environment_t *env);
  21. #define process_environment_free(env) \
  22. FREE_AND_NULL(process_environment_t, process_environment_free_, (env))
  23. struct smartlist_t *get_current_process_environment_variables(void);
  24. void set_environment_variable_in_smartlist(struct smartlist_t *env_vars,
  25. const char *new_var,
  26. void (*free_old)(void*),
  27. int free_p);
  28. #endif