OpenCoverage

strmatch.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/bash/src/lib/glob/strmatch.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/* strmatch.c -- ksh-like extended pattern matching for the shell and filename-
2 globbing. */-
3-
4/* Copyright (C) 1991-2002 Free Software Foundation, Inc.-
5-
6 This file is part of GNU Bash, the Bourne Again SHell.-
7 -
8 Bash is free software: you can redistribute it and/or modify-
9 it under the terms of the GNU General Public License as published by-
10 the Free Software Foundation, either version 3 of the License, or-
11 (at your option) any later version.-
12-
13 Bash is distributed in the hope that it will be useful,-
14 but WITHOUT ANY WARRANTY; without even the implied warranty of-
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-
16 GNU General Public License for more details.-
17-
18 You should have received a copy of the GNU General Public License-
19 along with Bash. If not, see <http://www.gnu.org/licenses/>.-
20*/-
21-
22#include <config.h>-
23-
24#include "stdc.h"-
25#include "strmatch.h"-
26-
27extern int xstrmatch __P((char *, char *, int));-
28#if defined (HANDLE_MULTIBYTE)-
29extern int internal_wstrmatch __P((wchar_t *, wchar_t *, int));-
30#endif-
31-
32int-
33strmatch (pattern, string, flags)-
34 char *pattern;-
35 char *string;-
36 int flags;-
37{-
38 if (string == 0 || pattern == 0)
string == 0Description
TRUEnever evaluated
FALSEevaluated 48823648 times by 1 test
Evaluated by:
  • Self test
pattern == 0Description
TRUEnever evaluated
FALSEevaluated 48823648 times by 1 test
Evaluated by:
  • Self test
0-48823648
39 return FNM_NOMATCH;
never executed: return 1;
0
40-
41 return (xstrmatch (pattern, string, flags));
executed 48823648 times by 1 test: return (xstrmatch (pattern, string, flags));
Executed by:
  • Self test
48823648
42}-
43-
44#if defined (HANDLE_MULTIBYTE)-
45int-
46wcsmatch (wpattern, wstring, flags)-
47 wchar_t *wpattern;-
48 wchar_t *wstring;-
49 int flags;-
50{-
51 if (wstring == 0 || wpattern == 0)
wstring == 0Description
TRUEnever evaluated
FALSEevaluated 9622991 times by 1 test
Evaluated by:
  • Self test
wpattern == 0Description
TRUEnever evaluated
FALSEevaluated 9622991 times by 1 test
Evaluated by:
  • Self test
0-9622991
52 return (FNM_NOMATCH);
never executed: return (1);
0
53-
54 return (internal_wstrmatch (wpattern, wstring, flags));
executed 9622991 times by 1 test: return (internal_wstrmatch (wpattern, wstring, flags));
Executed by:
  • Self test
9622991
55}-
56#endif-
57-
58#ifdef TEST-
59main (c, v)-
60 int c;-
61 char **v;-
62{-
63 char *string, *pat;-
64-
65 string = v[1];-
66 pat = v[2];-
67-
68 if (strmatch (pat, string, 0) == 0)-
69 {-
70 printf ("%s matches %s\n", string, pat);-
71 exit (0);-
72 }-
73 else-
74 {-
75 printf ("%s does not match %s\n", string, pat);-
76 exit (1);-
77 }-
78}-
79#endif-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.1.2