summaryrefslogtreecommitdiffstats
path: root/src/libs/zbxcommon
diff options
context:
space:
mode:
authorsasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-10-20 18:04:00 +0000
committersasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-10-20 18:04:00 +0000
commit381c6742533757053481569ae11496f8528cd37c (patch)
tree655a6b994d1affe5540ff34584f918b9fc6bc71f /src/libs/zbxcommon
parent68285fb56347e83ce36fc611482a09c84754f488 (diff)
downloadzabbix-381c6742533757053481569ae11496f8528cd37c.tar.gz
zabbix-381c6742533757053481569ae11496f8528cd37c.tar.xz
zabbix-381c6742533757053481569ae11496f8528cd37c.zip
- [ZBX-102] Distributed monitoring: overwriting information
[svn merge svn://svn.zabbix.com/branches/1.4.j -r4872:4874] git-svn-id: svn://svn.zabbix.com/trunk@4875 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/libs/zbxcommon')
-rw-r--r--src/libs/zbxcommon/str.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/libs/zbxcommon/str.c b/src/libs/zbxcommon/str.c
index 93ea6991..573fe066 100644
--- a/src/libs/zbxcommon/str.c
+++ b/src/libs/zbxcommon/str.c
@@ -1431,3 +1431,41 @@ char *zbx_get_next_field(const char *line, char **output, int *olen, char separa
return ret;
}
+
+/******************************************************************************
+ * *
+ * Function: str_in_list *
+ * *
+ * Purpose: check if string matches a list of demilited strings *
+ * *
+ * Parameters: list - strings a,b,ccc,ddd *
+ * value - value *
+ * delimiter- delimiter *
+ * *
+ * Return value: FAIL - out of period, SUCCEED - within the period *
+ * *
+ * Author: Alexei Vladishev *
+ * *
+ * Comments: *
+ * *
+ ******************************************************************************/
+int str_in_list(char *list, const char *value, const char delimiter)
+{
+ char *start, *end;
+ int ret = FAIL;
+
+ for (start = list; *start != '\0' && ret == FAIL;) {
+ if (NULL != (end = strchr(start, delimiter)))
+ *end = '\0';
+
+ if (0 == strcmp(start, value))
+ ret = SUCCEED;
+
+ if (end != NULL) {
+ *end = delimiter;
+ start = end + 1;
+ } else
+ break;
+ }
+ return ret;
+}