summaryrefslogtreecommitdiff
path: root/src/commit2.c
diff options
context:
space:
mode:
authorslioch <slioch@eng-140.vyatta.com>2009-06-03 10:40:35 -0700
committerslioch <slioch@eng-140.vyatta.com>2009-06-03 10:40:35 -0700
commit9a729a8cb2929a5272da6e240c9bd63db198f6c4 (patch)
tree520f7acccb0210a7c069c8d06302c862b9b98cf7 /src/commit2.c
parentdc59b7a411da1435631c9e223d3491b5332e0bc3 (diff)
downloadvyatta-cfg-9a729a8cb2929a5272da6e240c9bd63db198f6c4.tar.gz
vyatta-cfg-9a729a8cb2929a5272da6e240c9bd63db198f6c4.zip
added support for first and last sibling environment variable: "ENV_SIBLING_POSITION". This value will either be "FIRST" or "LAST" or undefined.
"FIRST" means that the sibling is the first in the list of a common parent, provided that the sibling resides in the same priority group "LAST" means that the sibling is the last in the list of a common parent, provided that the sibling resides in the same priority group
Diffstat (limited to 'src/commit2.c')
-rw-r--r--src/commit2.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/commit2.c b/src/commit2.c
index 70e0e99..6229221 100644
--- a/src/commit2.c
+++ b/src/commit2.c
@@ -377,6 +377,16 @@ process_func(GNode *node, gpointer data)
set_in_delete_action(TRUE);
}
+ //do last sibling check
+ GNode *n = g_node_last_sibling(node);
+ if (n == node) {
+ setenv(ENV_SIBLING_POSITION,"LAST",1);
+ }
+ n = g_node_first_sibling(node);
+ if (n == node) {
+ setenv(ENV_SIBLING_POSITION,"FIRST",1);
+ }
+
//do not set for promoted actions
if (!IS_ACTIVE(d->_operation)) {
if (IS_DELETE(d->_operation)) {
@@ -408,6 +418,7 @@ process_func(GNode *node, gpointer data)
}
unsetenv(ENV_ACTION_NAME);
+ unsetenv(ENV_SIBLING_POSITION);
if (g_coverage) {
struct timeval t;