MCPcopy Create free account
hub / github.com/Entware/Entware / env_expand

Function env_expand

scripts/config/preprocess.c:64–88  ·  view source on GitHub ↗

The returned pointer must be freed when done */

Source from the content-addressed store, hash-verified

62
63/* The returned pointer must be freed when done */
64static 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
90void env_write_dep(FILE *f, const char *autoconfig_name)
91{

Callers 1

eval_clauseFunction · 0.85

Calls 2

xstrdupFunction · 0.85
env_addFunction · 0.85

Tested by

no test coverage detected