| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: expand.c,v 1.133 2019/10/08 03:52:44 kre Exp $ */ | | 1 | /* $NetBSD: expand.c,v 1.134 2019/10/08 03:53:57 kre Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1991, 1993 | | 4 | * Copyright (c) 1991, 1993 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to Berkeley by | | 7 | * This code is derived from software contributed to Berkeley by |
8 | * Kenneth Almquist. | | 8 | * Kenneth Almquist. |
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 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
32 | * SUCH DAMAGE. | | 32 | * SUCH DAMAGE. |
33 | */ | | 33 | */ |
34 | | | 34 | |
35 | #include <sys/cdefs.h> | | 35 | #include <sys/cdefs.h> |
36 | #ifndef lint | | 36 | #ifndef lint |
37 | #if 0 | | 37 | #if 0 |
38 | static char sccsid[] = "@(#)expand.c 8.5 (Berkeley) 5/15/95"; | | 38 | static char sccsid[] = "@(#)expand.c 8.5 (Berkeley) 5/15/95"; |
39 | #else | | 39 | #else |
40 | __RCSID("$NetBSD: expand.c,v 1.133 2019/10/08 03:52:44 kre Exp $"); | | 40 | __RCSID("$NetBSD: expand.c,v 1.134 2019/10/08 03:53:57 kre Exp $"); |
41 | #endif | | 41 | #endif |
42 | #endif /* not lint */ | | 42 | #endif /* not lint */ |
43 | | | 43 | |
44 | #include <sys/types.h> | | 44 | #include <sys/types.h> |
45 | #include <sys/time.h> | | 45 | #include <sys/time.h> |
46 | #include <sys/stat.h> | | 46 | #include <sys/stat.h> |
47 | #include <errno.h> | | 47 | #include <errno.h> |
48 | #include <dirent.h> | | 48 | #include <dirent.h> |
49 | #include <unistd.h> | | 49 | #include <unistd.h> |
50 | #include <pwd.h> | | 50 | #include <pwd.h> |
51 | #include <limits.h> | | 51 | #include <limits.h> |
52 | #include <stdlib.h> | | 52 | #include <stdlib.h> |
53 | #include <stdio.h> | | 53 | #include <stdio.h> |
| @@ -1945,27 +1945,26 @@ patmatch(const char *pattern, const char | | | @@ -1945,27 +1945,26 @@ patmatch(const char *pattern, const char |
1945 | endp = p; | | 1945 | endp = p; |
1946 | if (*endp == '!' || *endp == '^') | | 1946 | if (*endp == '!' || *endp == '^') |
1947 | endp++; | | 1947 | endp++; |
1948 | for (;;) { | | 1948 | for (;;) { |
1949 | while (IS_BORING(*endp)) | | 1949 | while (IS_BORING(*endp)) |
1950 | endp++; | | 1950 | endp++; |
1951 | if (*endp == '\0') | | 1951 | if (*endp == '\0') |
1952 | goto dft; /* no matching ] */ | | 1952 | goto dft; /* no matching ] */ |
1953 | if (*endp++ == ']') | | 1953 | if (*endp++ == ']') |
1954 | break; | | 1954 | break; |
1955 | } | | 1955 | } |
1956 | /* end shortcut */ | | 1956 | /* end shortcut */ |
1957 | | | 1957 | |
1958 | invert = 0; | | | |
1959 | savep = p, saveq = q; | | 1958 | savep = p, saveq = q; |
1960 | invert = 0; | | 1959 | invert = 0; |
1961 | if (*p == '!' || *p == '^') { | | 1960 | if (*p == '!' || *p == '^') { |
1962 | invert++; | | 1961 | invert++; |
1963 | p++; | | 1962 | p++; |
1964 | } | | 1963 | } |
1965 | found = 0; | | 1964 | found = 0; |
1966 | if (*q == '\0') { | | 1965 | if (*q == '\0') { |
1967 | VTRACE(DBG_MATCH, ("[]fail\n")); | | 1966 | VTRACE(DBG_MATCH, ("[]fail\n")); |
1968 | return 0; | | 1967 | return 0; |
1969 | } | | 1968 | } |
1970 | if (squoted && *q == CTLESC) | | 1969 | if (squoted && *q == CTLESC) |
1971 | q++; | | 1970 | q++; |