From f0c5876c1203da45081d588fa2daf6b034281cba Mon Sep 17 00:00:00 2001 From: slioch Date: Fri, 27 Feb 2009 11:45:47 -0800 Subject: Added environment variable that can be accessed in executing node.def script to check whether commit is in a delete or set action. The environmental variable is "COMMIT_ACTION" the value can either be "SET" or "DELETE". The variable is set for the duration of the call being made to the action in the node.def file. This should allow some simplication of scripts (i.e. such as setting up static routes). --- src/commit2.c | 6 ++++++ src/common/defs.h | 5 +++++ 2 files changed, 11 insertions(+) (limited to 'src') diff --git a/src/commit2.c b/src/commit2.c index 871c085..4c0c342 100644 --- a/src/commit2.c +++ b/src/commit2.c @@ -334,13 +334,19 @@ process_func(GNode *node, gpointer data) fprintf(out_stream,"[START] %lu, %s@%s",(unsigned long)t.tv_sec,ActionNames[result->_action],d->_path); } + if (result->_action == delete_act) { + setenv(ENV_ACTION_NAME,ENV_ACTION_DELETE,1); set_in_delete_action(TRUE); } + else { + setenv(ENV_ACTION_NAME,ENV_ACTION_SET,1); + } status = execute_list(c->_def.actions[result->_action].vtw_list_head,&c->_def); if (result->_action == delete_act) { set_in_delete_action(FALSE); } + unsetenv(ENV_ACTION_NAME); if (g_coverage) { struct timeval t; diff --git a/src/common/defs.h b/src/common/defs.h index b489919..a26bfbc 100644 --- a/src/common/defs.h +++ b/src/common/defs.h @@ -11,6 +11,11 @@ #define MAX_DEPTH 128 +#define ENV_ACTION_NAME "COMMIT_ACTION" +#define ENV_ACTION_DELETE "DELETE" +#define ENV_ACTION_SET "SET" + + struct Result { int _err_code; -- cgit v1.2.3