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

Function variable_expand

scripts/config/preprocess.c:251–277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249}
250
251static char *variable_expand(const char *name, int argc, char *argv[])
252{
253 struct variable *v;
254 char *res;
255
256 v = variable_lookup(name);
257 if (!v)
258 return NULL;
259
260 if (argc == 0 && v->exp_count)
261 pperror("Recursive variable '%s' references itself (eventually)",
262 name);
263
264 if (v->exp_count > 1000)
265 pperror("Too deep recursive expansion");
266
267 v->exp_count++;
268
269 if (v->flavor == VAR_RECURSIVE)
270 res = expand_string_with_args(v->value, argc, argv);
271 else
272 res = xstrdup(v->value);
273
274 v->exp_count--;
275
276 return res;
277}
278
279void variable_add(const char *name, const char *value,
280 enum variable_flavor flavor)

Callers 1

eval_clauseFunction · 0.85

Calls 4

variable_lookupFunction · 0.85
pperrorFunction · 0.85
expand_string_with_argsFunction · 0.85
xstrdupFunction · 0.85

Tested by

no test coverage detected