Changeset 5670

Show
Ignore:
Timestamp:
02/23/10 21:58:14 (3 years ago)
Author:
blogic
Message:

make xml parser allow /> to close tags without real close tag

Location:
luci2/cbi2
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • luci2/cbi2/lucip.c

    r5664 r5670  
    1414#define TAG_OPEN        0 
    1515#define TAG_CLOSE       1 
     16#define TAG_OPENCLOSE   2 
    1617 
    1718#define lucip_fail(a,b) lucip_error(a,b,"") 
     
    104105} 
    105106 
    106 static int lucip_add_tag(struct lucip *l, const char *namespace, const char *widget, char *data) 
     107static int lucip_add_tag(struct lucip *l, const char *namespace, const char *widget, char *data, int close) 
    107108{ 
    108109    int r; 
     
    124125    else 
    125126        list_add_tail(&t->list, &l->tags); 
     127    if(close) 
     128        return MORE; 
    126129    if(l->stackcount >= STACK_DEPTH) 
    127130        return lucip_error(l, STACK_TOO_DEEP, "Stack depth has reached %d", STACK_DEPTH); 
     
    200203        ctag = TAG_CLOSE; 
    201204    } 
     205    if(stop[-1] == '/') 
     206    { 
     207        stop[-1] = '\0'; 
     208        printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__); 
     209        ctag = TAG_OPENCLOSE; 
     210    } 
    202211    *stop++ = '\0'; 
    203212    *colon++ = '\0'; 
     
    207216    l->last = l->pos = stop; 
    208217    if(ctag == TAG_OPEN) 
    209         return lucip_add_tag(l, start, colon, space); 
     218        return lucip_add_tag(l, start, colon, space, 0); 
     219    if(ctag == TAG_OPENCLOSE) 
     220        return lucip_add_tag(l, start, colon, space, 1); 
    210221    return lucip_close_tag(l, start, colon); 
    211222} 
  • luci2/cbi2/network.luci

    r5668 r5670  
    3434 
    3535<luci:page uci="network"> 
    36     <luci:section ref="network.interface" name="wan"></luci:section> 
     36    <luci:section ref="network.interface" name="wan"/> 
    3737    <luci:section package="dhcp" name="dhcp"> 
    3838        <luci:option uci="enable">Enable</luci:option>