fnmatch.c (17141) | fnmatch.c (17533) |
---|---|
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 --- 31 unchanged lines hidden (view full) --- 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 <string.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 --- 31 unchanged lines hidden (view full) --- 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 <string.h> |
48#include "collate.h" |
|
48 49#define EOS '\0' 50 51static const char *rangematch __P((const char *, int, int)); 52 53int 54fnmatch(pattern, string, flags) 55 const char *pattern, *string; --- 101 unchanged lines hidden (view full) --- 157 return (NULL); 158 if (*pattern == '-' 159 && (c2 = *(pattern+1)) != EOS && c2 != ']') { 160 pattern += 2; 161 if (c2 == '\\' && !(flags & FNM_NOESCAPE)) 162 c2 = *pattern++; 163 if (c2 == EOS) 164 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); |
165 if (c <= test && test <= c2) | 166 if ( __collcmp(c, test) <= 0 167 && __collcmp(test, c2) <= 0 168 ) |
166 ok = 1; 167 } else if (c == test) 168 ok = 1; 169 } 170 return (ok == negate ? NULL : pattern); 171} | 169 ok = 1; 170 } else if (c == test) 171 ok = 1; 172 } 173 return (ok == negate ? NULL : pattern); 174} |