parse.c (356345) | parse.c (361435) |
---|---|
1/* 2 * a generic (simple) parser. Use to parse rr's, private key 3 * information and /etc/resolv.conf files 4 * 5 * a Net::DNS like library for C 6 * LibDNS Team @ NLnet Labs 7 * (c) NLnet Labs, 2005-2006 8 * See the file LICENSE for the license --- 106 unchanged lines hidden (view full) --- 115 continue; 116 } 117 118 if (c == '\n' && p != 0 && t > token) { 119 /* in parentheses */ 120 if (line_nr) { 121 *line_nr = *line_nr + 1; 122 } | 1/* 2 * a generic (simple) parser. Use to parse rr's, private key 3 * information and /etc/resolv.conf files 4 * 5 * a Net::DNS like library for C 6 * LibDNS Team @ NLnet Labs 7 * (c) NLnet Labs, 2005-2006 8 * See the file LICENSE for the license --- 106 unchanged lines hidden (view full) --- 115 continue; 116 } 117 118 if (c == '\n' && p != 0 && t > token) { 119 /* in parentheses */ 120 if (line_nr) { 121 *line_nr = *line_nr + 1; 122 } |
123 if (limit > 0 && (i >= limit || (size_t)(t-token) >= limit)) { | 123 if (limit > 0 && (i+1 >= limit || (size_t)(t-token)+1 >= limit)) { |
124 *t = '\0'; 125 return -1; 126 } 127 *t++ = ' '; 128 prev_c = c; 129 continue; 130 } 131 --- 4 unchanged lines hidden (view full) --- 136 *line_nr = *line_nr + 1; 137 } 138 goto tokenread; 139 } 140 } 141 if (c != '\0' && c != '\n') { 142 i++; 143 } | 124 *t = '\0'; 125 return -1; 126 } 127 *t++ = ' '; 128 prev_c = c; 129 continue; 130 } 131 --- 4 unchanged lines hidden (view full) --- 136 *line_nr = *line_nr + 1; 137 } 138 goto tokenread; 139 } 140 } 141 if (c != '\0' && c != '\n') { 142 i++; 143 } |
144 if (limit > 0 && (i >= limit || (size_t)(t-token) >= limit)) { | 144 /* is there space for the character and the zero after it */ 145 if (limit > 0 && (i+1 >= limit || (size_t)(t-token)+1 >= limit)) { |
145 *t = '\0'; 146 return -1; 147 } 148 if (c != '\0' && c != '\n') { 149 *t++ = c; 150 } 151 if (c == '\\' && prev_c == '\\') 152 prev_c = 0; --- 168 unchanged lines hidden (view full) --- 321 lc = c; 322 continue; 323 } 324 325 if (c == '\n' && p != 0) { 326 /* in parentheses */ 327 /* do not write ' ' if we want to skip spaces */ 328 if(!(skipw && (strchr(skipw, c)||strchr(skipw, ' ')))) { | 146 *t = '\0'; 147 return -1; 148 } 149 if (c != '\0' && c != '\n') { 150 *t++ = c; 151 } 152 if (c == '\\' && prev_c == '\\') 153 prev_c = 0; --- 168 unchanged lines hidden (view full) --- 322 lc = c; 323 continue; 324 } 325 326 if (c == '\n' && p != 0) { 327 /* in parentheses */ 328 /* do not write ' ' if we want to skip spaces */ 329 if(!(skipw && (strchr(skipw, c)||strchr(skipw, ' ')))) { |
329 /* check for space for the space character */ 330 if (limit > 0 && (i >= limit || (size_t)(t-token) >= limit)) { | 330 /* check for space for the space character and a zero delimiter after that. */ 331 if (limit > 0 && (i+1 >= limit || (size_t)(t-token)+1 >= limit)) { |
331 *t = '\0'; 332 return -1; 333 } 334 *t++ = ' '; 335 } 336 lc = c; 337 continue; 338 } --- 10 unchanged lines hidden (view full) --- 349 for (d = del; *d; d++) { 350 /* we can only exit if no parens or user tracks them */ 351 if (c == *d && lc != '\\' && (p == 0 || par)) { 352 goto tokenread; 353 } 354 } 355 356 i++; | 332 *t = '\0'; 333 return -1; 334 } 335 *t++ = ' '; 336 } 337 lc = c; 338 continue; 339 } --- 10 unchanged lines hidden (view full) --- 350 for (d = del; *d; d++) { 351 /* we can only exit if no parens or user tracks them */ 352 if (c == *d && lc != '\\' && (p == 0 || par)) { 353 goto tokenread; 354 } 355 } 356 357 i++; |
357 if (limit > 0 && (i >= limit || (size_t)(t-token) >= limit)) { | 358 if (limit > 0 && (i+1 >= limit || (size_t)(t-token)+1 >= limit)) { |
358 *t = '\0'; 359 return -1; 360 } 361 *t++ = c; 362 363 if (c == '\\' && lc == '\\') { 364 lc = 0; 365 } else { --- 115 unchanged lines hidden --- | 359 *t = '\0'; 360 return -1; 361 } 362 *t++ = c; 363 364 if (c == '\\' && lc == '\\') { 365 lc = 0; 366 } else { --- 115 unchanged lines hidden --- |