Welcome to mirror list, hosted at ThFree Co, Russian Federation.

glob_pattern_p.cc « cygwin « winsup - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e8f42519bc900a2517975f00b38428f3b117c2ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* glob_pattern_p.c

   int glob_pattern_p (__const char *__pattern, int __quote)

   Return nonzero if PATTERN contains any metacharacters.
   Metacharacters can be quoted with backslashes if QUOTE is nonzero.

   This function is not part of the interface specified by POSIX.2
   but several programs want to use it.  */

#include <string.h>

extern "C" {

int glob_pattern_p (const char *pattern, int quote)
{
  const char *quote_chars = "\\?*[]";
  if (!quote)
    quote_chars++;
  while ((pattern = strpbrk (pattern, quote_chars)) != NULL)
    if (*pattern == '\\')
      pattern++;
    else
      return true;
  return false;
}

} /* extern "C" */