fnmatch.c (17533) | fnmatch.c (17552) |
---|---|
1/* 2 * Copyright (c) 1989, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Guido van Rossum. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 30 unchanged lines hidden (view full) --- 39#endif /* LIBC_SCCS and not lint */ 40 41/* 42 * Function fnmatch() as specified in POSIX 1003.2-1992, section B.6. 43 * Compares a filename or pathname to a pattern. 44 */ 45 46#include <fnmatch.h> | 1/* 2 * Copyright (c) 1989, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Guido van Rossum. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 30 unchanged lines hidden (view full) --- 39#endif /* LIBC_SCCS and not lint */ 40 41/* 42 * Function fnmatch() as specified in POSIX 1003.2-1992, section B.6. 43 * Compares a filename or pathname to a pattern. 44 */ 45 46#include <fnmatch.h> |
47#include <locale.h> |
|
47#include <string.h> | 48#include <string.h> |
48#include "collate.h" | |
49 50#define EOS '\0' 51 52static const char *rangematch __P((const char *, int, int)); 53 54int 55fnmatch(pattern, string, flags) 56 const char *pattern, *string; --- 101 unchanged lines hidden (view full) --- 158 return (NULL); 159 if (*pattern == '-' 160 && (c2 = *(pattern+1)) != EOS && c2 != ']') { 161 pattern += 2; 162 if (c2 == '\\' && !(flags & FNM_NOESCAPE)) 163 c2 = *pattern++; 164 if (c2 == EOS) 165 return (NULL); | 49 50#define EOS '\0' 51 52static const char *rangematch __P((const char *, int, int)); 53 54int 55fnmatch(pattern, string, flags) 56 const char *pattern, *string; --- 101 unchanged lines hidden (view full) --- 158 return (NULL); 159 if (*pattern == '-' 160 && (c2 = *(pattern+1)) != EOS && c2 != ']') { 161 pattern += 2; 162 if (c2 == '\\' && !(flags & FNM_NOESCAPE)) 163 c2 = *pattern++; 164 if (c2 == EOS) 165 return (NULL); |
166 if ( __collcmp(c, test) <= 0 167 && __collcmp(test, c2) <= 0 | 166 if ( collate_range_cmp(c, test) <= 0 167 && collate_range_cmp(test, c2) <= 0 |
168 ) 169 ok = 1; 170 } else if (c == test) 171 ok = 1; 172 } 173 return (ok == negate ? NULL : pattern); 174} | 168 ) 169 ok = 1; 170 } else if (c == test) 171 ok = 1; 172 } 173 return (ok == negate ? NULL : pattern); 174} |