The returned pointer must be freed when done */
| 62 | |
| 63 | /* The returned pointer must be freed when done */ |
| 64 | static char *env_expand(const char *name) |
| 65 | { |
| 66 | struct env *e; |
| 67 | const char *value; |
| 68 | |
| 69 | if (!*name) |
| 70 | return NULL; |
| 71 | |
| 72 | list_for_each_entry(e, &env_list, node) { |
| 73 | if (!strcmp(name, e->name)) |
| 74 | return xstrdup(e->value); |
| 75 | } |
| 76 | |
| 77 | value = getenv(name); |
| 78 | if (!value) |
| 79 | return NULL; |
| 80 | |
| 81 | /* |
| 82 | * We need to remember all referenced environment variables. |
| 83 | * They will be written out to include/config/auto.conf.cmd |
| 84 | */ |
| 85 | env_add(name, value); |
| 86 | |
| 87 | return xstrdup(value); |
| 88 | } |
| 89 | |
| 90 | void env_write_dep(FILE *f, const char *autoconfig_name) |
| 91 | { |
no test coverage detected