[svn-commits] tilghman: trunk r696 - in /trunk: menuselect.c menuselect.h
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Feb 2 13:01:18 CST 2010
Author: tilghman
Date: Tue Feb 2 13:01:15 2010
New Revision: 696
URL: http://svnview.digium.com/svn/menuselect?view=rev&rev=696
Log:
Add touch_on_change property to both categories and members.
Reviewboard: https://reviewboard.asterisk.org/r/482/
Modified:
trunk/menuselect.c
trunk/menuselect.h
Modified: trunk/menuselect.c
URL: http://svnview.digium.com/svn/menuselect/trunk/menuselect.c?view=diff&rev=696&r1=695&r2=696
==============================================================================
--- trunk/menuselect.c (original)
+++ trunk/menuselect.c Tue Feb 2 13:01:15 2010
@@ -263,6 +263,8 @@
cat->exclusive = !strcasecmp(tmp, "yes");
if ((tmp = mxmlElementGetAttr(cur, "remove_on_change")))
cat->remove_on_change = tmp;
+ if ((tmp = mxmlElementGetAttr(cur, "touch_on_change")))
+ cat->touch_on_change = tmp;
for (cur2 = mxmlFindElement(cur, cur, "member", NULL, NULL, MXML_DESCEND_FIRST);
cur2;
@@ -273,8 +275,9 @@
mem->name = mxmlElementGetAttr(cur2, "name");
mem->displayname = mxmlElementGetAttr(cur2, "displayname");
-
+ mem->touch_on_change = mxmlElementGetAttr(cur2, "touch_on_change");
mem->remove_on_change = mxmlElementGetAttr(cur2, "remove_on_change");
+
if (!cat->positive_output) {
mem->was_enabled = mem->enabled = 1;
print_debug("Enabling %s because the category does not have positive output\n", mem->name);
@@ -1179,6 +1182,7 @@
AST_LIST_TRAVERSE(&categories, cat, list) {
unsigned int had_changes = 0;
char rmcommand[256] = "rm -rf ";
+ char touchcommand[256] = "touch -c ";
char *file, *buf;
AST_LIST_TRAVERSE(&cat->members, mem, list) {
@@ -1186,6 +1190,15 @@
continue;
had_changes = 1;
+
+ if (mem->touch_on_change) {
+ for (buf = ast_strdupa(mem->touch_on_change), file = strsep(&buf, " ");
+ file;
+ file = strsep(&buf, " ")) {
+ strcpy(&touchcommand[9], file);
+ system(touchcommand);
+ }
+ }
if (mem->remove_on_change) {
for (buf = ast_strdupa(mem->remove_on_change), file = strsep(&buf, " ");
@@ -1194,6 +1207,15 @@
strcpy(&rmcommand[7], file);
system(rmcommand);
}
+ }
+ }
+
+ if (cat->touch_on_change && had_changes) {
+ for (buf = ast_strdupa(cat->touch_on_change), file = strsep(&buf, " ");
+ file;
+ file = strsep(&buf, " ")) {
+ strcpy(&touchcommand[9], file);
+ system(touchcommand);
}
}
Modified: trunk/menuselect.h
URL: http://svnview.digium.com/svn/menuselect/trunk/menuselect.h?view=diff&rev=696&r1=695&r2=696
==============================================================================
--- trunk/menuselect.h (original)
+++ trunk/menuselect.h Tue Feb 2 13:01:15 2010
@@ -84,6 +84,8 @@
const char *defaultenabled;
/*! Delete these file(s) if this member changes */
const char *remove_on_change;
+ /*! Touch these file(s) if this member changes */
+ const char *touch_on_change;
/*! This module is currently selected */
unsigned int enabled:1;
/*! This module was enabled when the config was loaded */
@@ -115,6 +117,8 @@
const char *displayname;
/*! Delete these file(s) if anything in this category changes */
const char *remove_on_change;
+ /*! Touch these file(s) if anything in this category changes */
+ const char *touch_on_change;
/*! Output what is selected, as opposed to not selected */
unsigned int positive_output:1;
/*! All choices in this category are mutually exclusive */
More information about the svn-commits
mailing list