diff options
author | Alexander A. Klimov <alexander.klimov@icinga.com> | 2023-08-23 18:13:01 +0200 |
---|---|---|
committer | Alexander A. Klimov <alexander.klimov@icinga.com> | 2023-09-28 13:20:24 +0200 |
commit | d31a696cadb0bba0914d76aad0eb48c6e7962b8e (patch) | |
tree | df4f0161edb46f28963ad80cb37baf309dff3434 /lib | |
parent | f457615d845ec3bf9d3072511999b69d93c934c5 (diff) | |
download | monitoring-plugins-d31a696.tar.gz |
Introduce np_add_regex()
Diffstat (limited to 'lib')
-rw-r--r-- | lib/utils_disk.c | 11 | ||||
-rw-r--r-- | lib/utils_disk.h | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/utils_disk.c b/lib/utils_disk.c index 582d3ea1..ce02fdff 100644 --- a/lib/utils_disk.c +++ b/lib/utils_disk.c | |||
@@ -40,6 +40,17 @@ np_add_name (struct name_list **list, const char *name) | |||
40 | *list = new_entry; | 40 | *list = new_entry; |
41 | } | 41 | } |
42 | 42 | ||
43 | /* Initialises a new regex at the begin of list via regcomp(3) */ | ||
44 | int | ||
45 | np_add_regex (struct regex_list **list, const char *regex, int cflags) | ||
46 | { | ||
47 | struct regex_list *new_entry = (struct regex_list *) malloc (sizeof *new_entry); | ||
48 | new_entry->next = *list; | ||
49 | *list = new_entry; | ||
50 | |||
51 | return regcomp(&new_entry->regex, regex, cflags); | ||
52 | } | ||
53 | |||
43 | /* Initialises a new parameter at the end of list */ | 54 | /* Initialises a new parameter at the end of list */ |
44 | struct parameter_list * | 55 | struct parameter_list * |
45 | np_add_parameter(struct parameter_list **list, const char *name) | 56 | np_add_parameter(struct parameter_list **list, const char *name) |
diff --git a/lib/utils_disk.h b/lib/utils_disk.h index 442fd94f..bda088f6 100644 --- a/lib/utils_disk.h +++ b/lib/utils_disk.h | |||
@@ -41,6 +41,7 @@ struct parameter_list | |||
41 | void np_add_name (struct name_list **list, const char *name); | 41 | void np_add_name (struct name_list **list, const char *name); |
42 | int np_find_name (struct name_list *list, const char *name); | 42 | int np_find_name (struct name_list *list, const char *name); |
43 | int np_seen_name (struct name_list *list, const char *name); | 43 | int np_seen_name (struct name_list *list, const char *name); |
44 | int np_add_regex (struct regex_list **list, const char *regex, int cflags); | ||
44 | struct parameter_list *np_add_parameter(struct parameter_list **list, const char *name); | 45 | struct parameter_list *np_add_parameter(struct parameter_list **list, const char *name); |
45 | struct parameter_list *np_find_parameter(struct parameter_list *list, const char *name); | 46 | struct parameter_list *np_find_parameter(struct parameter_list *list, const char *name); |
46 | struct parameter_list *np_del_parameter(struct parameter_list *item, struct parameter_list *prev); | 47 | struct parameter_list *np_del_parameter(struct parameter_list *item, struct parameter_list *prev); |