diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2006-07-12 22:53:27 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2006-07-12 22:53:27 +0000 |
commit | a46e358d68027289cffaffeb7a4b32ababb2105b (patch) | |
tree | 0d426cd3d3a360c98e048cb2cc63d6faceedbc2d /plugins/utils_disk.c | |
parent | 4edea20b86fb08209ffb38c77be2df1d3a373e82 (diff) | |
download | monitoring-plugins-a46e358d68027289cffaffeb7a4b32ababb2105b.tar.gz |
Added -E option for exact match of filesystem. Restructured main filesystem
loop. Added extra tests for possible duplicate filesystems.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1449 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/utils_disk.c')
-rw-r--r-- | plugins/utils_disk.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/plugins/utils_disk.c b/plugins/utils_disk.c index 0a71d792..31284d5d 100644 --- a/plugins/utils_disk.c +++ b/plugins/utils_disk.c | |||
@@ -43,9 +43,11 @@ np_add_name (struct name_list **list, const char *name) | |||
43 | *list = new_entry; | 43 | *list = new_entry; |
44 | } | 44 | } |
45 | 45 | ||
46 | void | 46 | /* Initialises a new parameter at the end of list */ |
47 | struct parameter_list * | ||
47 | np_add_parameter(struct parameter_list **list, const char *name) | 48 | np_add_parameter(struct parameter_list **list, const char *name) |
48 | { | 49 | { |
50 | struct parameter_list *current = *list; | ||
49 | struct parameter_list *new_path; | 51 | struct parameter_list *new_path; |
50 | new_path = (struct parameter_list *) malloc (sizeof *new_path); | 52 | new_path = (struct parameter_list *) malloc (sizeof *new_path); |
51 | new_path->name = (char *) name; | 53 | new_path->name = (char *) name; |
@@ -57,8 +59,17 @@ np_add_parameter(struct parameter_list **list, const char *name) | |||
57 | new_path->c_dfp = -1.0; | 59 | new_path->c_dfp = -1.0; |
58 | new_path->w_idfp = -1.0; | 60 | new_path->w_idfp = -1.0; |
59 | new_path->c_idfp = -1.0; | 61 | new_path->c_idfp = -1.0; |
60 | new_path->name_next = *list; | 62 | new_path->best_match = NULL; |
61 | *list = new_path; | 63 | |
64 | if (current == NULL) { | ||
65 | *list = new_path; | ||
66 | } else { | ||
67 | while (current->name_next) { | ||
68 | current = current->name_next; | ||
69 | } | ||
70 | current->name_next = new_path; | ||
71 | } | ||
72 | return new_path; | ||
62 | } | 73 | } |
63 | 74 | ||
64 | void | 75 | void |
@@ -93,6 +104,8 @@ np_set_best_match(struct parameter_list *desired, struct mount_entry *mount_list | |||
93 | if (best_match) { | 104 | if (best_match) { |
94 | d->best_match = best_match; | 105 | d->best_match = best_match; |
95 | d->found = TRUE; | 106 | d->found = TRUE; |
107 | } else { | ||
108 | d->best_match = NULL; /* Not sure why this is needed as it should be null on initialisation */ | ||
96 | } | 109 | } |
97 | } | 110 | } |
98 | } | 111 | } |
@@ -114,3 +127,15 @@ np_find_name (struct name_list *list, const char *name) | |||
114 | return FALSE; | 127 | return FALSE; |
115 | } | 128 | } |
116 | 129 | ||
130 | int | ||
131 | np_seen_name(struct name_list *list, const char *name) | ||
132 | { | ||
133 | const struct name_list *s; | ||
134 | for (s = list; s; s=s->next) { | ||
135 | if (!strcmp(s->name, name)) { | ||
136 | return TRUE; | ||
137 | } | ||
138 | } | ||
139 | return FALSE; | ||
140 | } | ||
141 | |||