src/hg/lib/hgConfig.c 1.21
1.21 2009/08/27 23:09:51 markd
added hg.conf directive to delete variables
Index: src/hg/lib/hgConfig.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/lib/hgConfig.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -b -B -U 4 -r1.20 -r1.21
--- src/hg/lib/hgConfig.c 8 Sep 2008 18:20:37 -0000 1.20
+++ src/hg/lib/hgConfig.c 27 Aug 2009 23:09:51 -0000 1.21
@@ -22,9 +22,9 @@
// forwards
static void parseConfigFile(char *filename, int depth);
/* the hash holding the config options */
-static struct hash* cfgOptionsHash = 0;
+static struct hash* cfgOptionsHash = NULL;
static boolean isBrowserCgi()
/* test if this is a browser CGI */
{
@@ -118,8 +118,17 @@
}
parseConfigFile(incfile, depth+1);
}
+static void parseConfigDelete(struct lineFile *lf, char *line)
+/* parse and process a delete directive */
+{
+char *p = line, *var;
+(void)nextWord(&p); // skip "delete"
+while ((var = nextWord(&p)) != NULL)
+ hashRemove(cfgOptionsHash, var);
+}
+
static void parseConfigLine(struct lineFile *lf, int depth, char *line)
/* parse one non-comment, non-blank line of the config file.
* If keyword=value, put in global hash, otherwise process
* includes. */
@@ -127,8 +136,10 @@
/* parse the key/value pair */
char *name = trimSpaces(line);
if (startsWithWord("include", line))
parseConfigInclude(lf, depth, line);
+else if (startsWithWord("delete", line))
+ parseConfigDelete(lf, line);
else
{
char *value = strchr(name, '=');
if (value == NULL)