env.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. /**
  6. * \file env.h
  7. * \brief Header for env.c
  8. **/
  9. #ifndef TOR_ENV_H
  10. #define TOR_ENV_H
  11. char **get_environment(void);
  12. struct smartlist_t;
  13. int environment_variable_names_equal(const char *s1, const char *s2);
  14. /* DOCDOC process_environment_t */
  15. typedef struct process_environment_t {
  16. /** A pointer to a sorted empty-string-terminated sequence of
  17. * NUL-terminated strings of the form "NAME=VALUE". */
  18. char *windows_environment_block;
  19. /** A pointer to a NULL-terminated array of pointers to
  20. * NUL-terminated strings of the form "NAME=VALUE". */
  21. char **unixoid_environment_block;
  22. } process_environment_t;
  23. process_environment_t *process_environment_make(struct smartlist_t *env_vars);
  24. void process_environment_free_(process_environment_t *env);
  25. #define process_environment_free(env) \
  26. FREE_AND_NULL(process_environment_t, process_environment_free_, (env))
  27. struct smartlist_t *get_current_process_environment_variables(void);
  28. void set_environment_variable_in_smartlist(struct smartlist_t *env_vars,
  29. const char *new_var,
  30. void (*free_old)(void*),
  31. int free_p);
  32. #endif