OpenVAS Scanner  7.0.0~git
strutils.c
Go to the documentation of this file.
1 /* Copyright (C) 2009-2019 Greenbone Networks GmbH
2  *
3  * SPDX-License-Identifier: GPL-2.0-or-later
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * version 2 as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #include <glib.h>
20 
30 int
31 str_match (const gchar *string, const gchar *pattern, int icase)
32 {
33  gboolean res;
34  GPatternSpec *patt = NULL;
35 
36  if (icase)
37  {
38  patt = g_pattern_spec_new (g_ascii_strdown (pattern, -1));
39  res = g_pattern_match_string (patt, g_ascii_strdown (string, -1));
40  }
41  else
42  {
43  patt = g_pattern_spec_new (pattern);
44  res = g_pattern_match_string (patt, string);
45  }
46  g_pattern_spec_free (patt);
47  return res;
48 }
str_match
int str_match(const gchar *string, const gchar *pattern, int icase)
Matches a string against a pattern.
Definition: strutils.c:31