OpenVAS Scanner  7.0.0~git
strutils.c File Reference
#include <glib.h>
Include dependency graph for strutils.c:

Go to the source code of this file.

Functions

int str_match (const gchar *string, const gchar *pattern, int icase)
 Matches a string against a pattern. More...
 

Function Documentation

◆ str_match()

int str_match ( const gchar *  string,
const gchar *  pattern,
int  icase 
)

Matches a string against a pattern.

Parameters
[in]stringString to match.
[in]patternPattern to match against.
[in]icaseCase insensitivity enabled.
Returns
1 if it matches. 0 otherwise.

Definition at line 31 of file strutils.c.

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 }

Referenced by nasl_match().

Here is the caller graph for this function: