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

[db9d1c2db7c42ea70190db97aab99fd029180d11]

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

refs #115, split version into its own field

Files:

Legend:

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

    rdb9d1c2 r068f02c  
    103103      while(noit_hash_next(sc, &sc_iter, &sc_k, &sc_klen, &sc_data)) { 
    104104        xmlNodePtr scnode; 
     105        char *name_copy, *version = NULL; 
    105106        eventer_func_t *f = (eventer_func_t *)sc_data; 
    106107 
    107108        snprintf(hexcode, sizeof(hexcode), "0x%08x", *((u_int32_t *)sc_k)); 
    108109        name = eventer_name_for_callback(*f); 
     110        name_copy = strdup(name ? name : "[[unknown]]"); 
     111        version = strchr(name_copy, '/'); 
     112        if(version) *version++ = '\0'; 
     113 
    109114        scnode = xmlNewNode(NULL, (xmlChar *)"command"); 
    110         xmlSetProp(scnode, (xmlChar *)"name", name ? (xmlChar *)name : NULL); 
     115        xmlSetProp(scnode, (xmlChar *)"name", (xmlChar *)name_copy); 
     116        if(version) 
     117          xmlSetProp(scnode, (xmlChar *)"version", (xmlChar *)version); 
    111118        xmlSetProp(scnode, (xmlChar *)"code", (xmlChar *)hexcode); 
    112119        xmlAddChild(cnode, scnode); 
     120        free(name_copy); 
    113121      } 
    114122    }