version 1.100, 2016/10/14 09:27:21 |
version 1.101, 2016/10/23 14:54:14 |
|
|
#include "config.h" |
#include "config.h" |
#include "defines.h" |
#include "defines.h" |
#include "buf.h" |
#include "buf.h" |
|
#include "cmd_exec.h" |
#include "stats.h" |
#include "stats.h" |
#include "pathnames.h" |
#include "pathnames.h" |
#include "varmodifiers.h" |
#include "varmodifiers.h" |
|
|
static Var *create_var(const char *, const char *); |
static Var *create_var(const char *, const char *); |
static void var_set_initial_value(Var *, const char *); |
static void var_set_initial_value(Var *, const char *); |
static void var_set_value(Var *, const char *); |
static void var_set_value(Var *, const char *); |
#define var_get_value(v) Buf_Retrieve(&((v)->val)) |
#define var_get_value(v) ((v)->flags & VAR_EXEC_LATER ? \ |
|
var_exec_cmd(v) : \ |
|
Buf_Retrieve(&((v)->val))) |
|
static char *var_exec_cmd(Var *); |
static void var_append_value(Var *, const char *); |
static void var_append_value(Var *, const char *); |
static void poison_check(Var *); |
static void poison_check(Var *); |
static void var_set_append(const char *, const char *, const char *, int, bool); |
static void var_set_append(const char *, const char *, const char *, int, bool); |
|
|
return v; |
return v; |
} |
} |
|
|
/* mark variable as poisoned, in a given setup. |
/* mark variable with special flags, in a given setup. |
*/ |
*/ |
void |
void |
Var_MarkPoisoned(const char *name, const char *ename, unsigned int type) |
Var_Mark(const char *name, const char *ename, unsigned int type) |
{ |
{ |
Var *v; |
Var *v; |
uint32_t k; |
uint32_t k; |
|
|
int ctxt) |
int ctxt) |
{ |
{ |
var_set_append(name, ename, val, ctxt, true); |
var_set_append(name, ename, val, ctxt, true); |
|
} |
|
|
|
static char * |
|
var_exec_cmd(Var *v) |
|
{ |
|
char *arg = Buf_Retrieve(&(v->val)); |
|
char *err; |
|
char *res1; |
|
res1 = Cmd_Exec(arg, &err); |
|
if (err) |
|
Parse_Error(PARSE_WARNING, err, arg); |
|
var_set_value(v, res1); |
|
free(res1); |
|
v->flags &= ~VAR_EXEC_LATER; |
|
return Buf_Retrieve(&(v->val)); |
} |
} |
|
|
/* XXX different semantics for Var_Valuei() and Var_Definedi(): |
/* XXX different semantics for Var_Valuei() and Var_Definedi(): |