OpenVAS Scanner 23.40.3
strutils.c File Reference
#include "strutils.h"
#include "support.h"
#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.

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 22 of file strutils.c.

23{
24 gboolean res;
25 GPatternSpec *patt = NULL;
26
27 if (icase)
28 {
29 patt = g_pattern_spec_new (g_ascii_strdown (pattern, -1));
30 res = g_pattern_spec_match_string (patt, g_ascii_strdown (string, -1));
31 }
32 else
33 {
34 patt = g_pattern_spec_new (pattern);
35 res = g_pattern_spec_match_string (patt, string);
36 }
37 g_pattern_spec_free (patt);
38 return res;
39}

Referenced by nasl_match().

Here is the caller graph for this function: