| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: att.c,v 1.5 2011/11/06 16:26:54 christos Exp $ */ | | 1 | /* $NetBSD: att.c,v 1.6 2011/11/06 16:43:25 christos Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2011 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2011 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Christos Zoulas. | | 8 | * by Christos Zoulas. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -27,27 +27,27 @@ | | | @@ -27,27 +27,27 @@ |
27 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 27 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
28 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 28 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
29 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 29 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
30 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 30 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
32 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 32 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
35 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 35 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
36 | * POSSIBILITY OF SUCH DAMAGE. | | 36 | * POSSIBILITY OF SUCH DAMAGE. |
37 | */ | | 37 | */ |
38 | | | 38 | |
39 | #include <sys/cdefs.h> | | 39 | #include <sys/cdefs.h> |
40 | __RCSID("$NetBSD: att.c,v 1.5 2011/11/06 16:26:54 christos Exp $"); | | 40 | __RCSID("$NetBSD: att.c,v 1.6 2011/11/06 16:43:25 christos Exp $"); |
41 | | | 41 | |
42 | #include <stdio.h> | | 42 | #include <stdio.h> |
43 | #include <regex.h> | | 43 | #include <regex.h> |
44 | #include <string.h> | | 44 | #include <string.h> |
45 | #include <stdlib.h> | | 45 | #include <stdlib.h> |
46 | #include <vis.h> | | 46 | #include <vis.h> |
47 | #include <ctype.h> | | 47 | #include <ctype.h> |
48 | #include <atf-c.h> | | 48 | #include <atf-c.h> |
49 | | | 49 | |
50 | ATF_TC(regex_att); | | 50 | ATF_TC(regex_att); |
51 | | | 51 | |
52 | ATF_TC_HEAD(regex_att, tc) | | 52 | ATF_TC_HEAD(regex_att, tc) |
53 | { | | 53 | { |
| @@ -354,28 +354,29 @@ checkmatches(const char *matches, size_t | | | @@ -354,28 +354,29 @@ checkmatches(const char *matches, size_t |
354 | | | 354 | |
355 | ATF_TC_BODY(regex_att, tc) | | 355 | ATF_TC_BODY(regex_att, tc) |
356 | { | | 356 | { |
357 | regex_t re; | | 357 | regex_t re; |
358 | char *line, *lastpattern = NULL; | | 358 | char *line, *lastpattern = NULL; |
359 | size_t len, lineno = 0; | | 359 | size_t len, lineno = 0; |
360 | int skipping = 0; | | 360 | int skipping = 0; |
361 | | | 361 | |
362 | for (; (line = fparseln(stdin, &len, &lineno, delim, 0)) | | 362 | for (; (line = fparseln(stdin, &len, &lineno, delim, 0)) |
363 | != NULL; free(line)) { | | 363 | != NULL; free(line)) { |
364 | char *name, *pattern, *input, *matches, *comment; | | 364 | char *name, *pattern, *input, *matches, *comment; |
365 | regmatch_t *pm; | | 365 | regmatch_t *pm; |
366 | size_t nm; | | 366 | size_t nm; |
367 | | | 367 | #ifdef DEBUG |
368 | fprintf(stderr, "[%s]\n", line); | | 368 | fprintf(stderr, "[%s]\n", line); |
| | | 369 | #endif |
369 | if ((name = strtok(line, sep)) == NULL) | | 370 | if ((name = strtok(line, sep)) == NULL) |
370 | continue; | | 371 | continue; |
371 | | | 372 | |
372 | /* | | 373 | /* |
373 | * We check these early so that we skip the lines quickly | | 374 | * We check these early so that we skip the lines quickly |
374 | * in order to do more strict testing on the other arguments | | 375 | * in order to do more strict testing on the other arguments |
375 | * The same characters are also tested in the switch below | | 376 | * The same characters are also tested in the switch below |
376 | */ | | 377 | */ |
377 | if (*name == '}') { | | 378 | if (*name == '}') { |
378 | skipping = 0; | | 379 | skipping = 0; |
379 | continue; | | 380 | continue; |
380 | } | | 381 | } |
381 | if (skipping) | | 382 | if (skipping) |