Changeset 6f0b2ab04b6e742c4bac93acdc575612ceabcae1

Show
Ignore:
Timestamp:
09/18/09 00:23:15 (5 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1253233395 +0000
git-parent:

[57cd7b0a283390410c6f4deca487bd80097826ee]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1253233395 +0000
Message:

refs #171, supports inherit flags on config stanzas

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/noit_check_rest.c

    ra4484cb r6f0b2ab  
    11/* 
    2  * Copyright (c) 2007, OmniTI Computer Consulting, Inc. 
     2 * Copyright (c) 2009, OmniTI Computer Consulting, Inc. 
    33 * All rights reserved. 
    44 * 
     
    248248  for(tl = root->children; tl; tl = tl->next) { 
    249249    if(!strcmp((char *)tl->name, "attributes")) { 
    250       *a = tl->children
     250      *a = tl
    251251      for(an = tl->children; an; an = an->next) { 
    252252#define CHECK_N_SET(a) if(!strcmp((char *)an->name, #a)) 
     
    314314    } 
    315315    else if(!strcmp((char *)tl->name, "config")) { 
    316       *c = tl->children
     316      *c = tl
    317317      /* Noop, anything goes */ 
    318318    } 
     
    326326configure_xml_check(xmlNodePtr check, xmlNodePtr a, xmlNodePtr c) { 
    327327  xmlNodePtr n, config, oldconfig; 
    328   for(n = a; n; n = n->next) { 
     328  for(n = a->children; n; n = n->next) { 
    329329#define ATTR2PROP(attr) do { \ 
    330330  if(!strcmp((char *)n->name, #attr)) { \ 
     
    346346    if(!strcmp((char *)oldconfig->name, "config")) break; 
    347347  config = xmlNewNode(NULL, (xmlChar *)"config"); 
    348   for(n = c; n; n = n->next) { 
    349     xmlNodePtr co = xmlNewNode(NULL, n->name); 
    350     xmlNodeAddContent(co, XML_GET_CONTENT(n)); 
    351     xmlAddChild(config, co); 
     348  if(c) { 
     349    xmlAttrPtr inherit; 
     350    if((inherit = xmlHasProp(c, (xmlChar *)"inherit")) != NULL && 
     351        inherit->children && inherit->children->content) 
     352      xmlSetProp(config, (xmlChar *)"inherit", inherit->children->content); 
     353    for(n = c->children; n; n = n->next) { 
     354      xmlNodePtr co = xmlNewNode(NULL, n->name); 
     355      xmlNodeAddContent(co, XML_GET_CONTENT(n)); 
     356      xmlAddChild(config, co); 
     357    } 
    352358  } 
    353359  if(oldconfig) { 
     
    513519      xmlNodePtr newcheck, a; 
    514520      /* make sure this isn't a dup */ 
    515       for(a = attr; a; a = a->next) { 
     521      for(a = attr->children; a; a = a->next) { 
    516522        if(!strcmp((char *)a->name, "target")) 
    517523          target = (char *)xmlNodeGetContent(a); 
     
    551557 
    552558    /* make sure this isn't a dup */ 
    553     for(a = attr; a; a = a->next) { 
     559    for(a = attr->children; a; a = a->next) { 
    554560      if(!strcmp((char *)a->name, "target")) 
    555561        target = (char *)xmlNodeGetContent(a);