summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes1
-rw-r--r--include/extern.h4
-rw-r--r--src/config.c24
-rw-r--r--src/misc.c27
4 files changed, 32 insertions, 24 deletions
diff --git a/Changes b/Changes
index d85b6fe50..f5eeb0ffc 100644
--- a/Changes
+++ b/Changes
@@ -2,6 +2,7 @@ Anope Version S V N
--------------------
Provided by Anope Dev. <dev@anope.org> - 2005
01/14 F SGLines will now be removed correctly. [ #00]
+01/26 F Export buildStringList() for modules. [#425]
Provided by nenolod. <nenolod@nenolod.net> - 2005
01/15 F va_arg issue on various 64bit platforms. [#415]
diff --git a/include/extern.h b/include/extern.h
index 90c01744e..ea0995f08 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -839,6 +839,10 @@ E char *str_signed(unsigned char *str);
E void ntoa(struct in_addr addr, char *ipaddr, int len);
+E char **buildStringList(char *src, int *number);
+
+
+
/**** modules.c ****/
E void modules_core_init(int number, char **list);
E void modules_unload_all(boolean fini); /* Read warnings near function source */
diff --git a/src/config.c b/src/config.c
index 2e4e0e1dd..b46904a6b 100644
--- a/src/config.c
+++ b/src/config.c
@@ -355,10 +355,6 @@ int NumUlines;
int UseTS6;
-
-
-char **buildStringList(char *src, int *number);
-
/*************************************************************************/
/* Deprecated directive (dep_) and value checking (chk_) functions: */
@@ -1430,24 +1426,4 @@ int read_config(int reload)
}
-char **buildStringList(char *src, int *number)
-{
- char *s;
- int i = 0;
- char **list = NULL;
-
- if (src) {
- s = strtok(src, " ");
- do {
- if (s) {
- i++;
- list = realloc(list, sizeof(char *) * i);
- list[i - 1] = sstrdup(s);
- }
- } while ((s = strtok(NULL, " ")));
- }
- *number = i; /* always zero it, even if we have no setters */
- return list;
-}
-
/*************************************************************************/
diff --git a/src/misc.c b/src/misc.c
index 478fe98bb..7ac0a809e 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -1158,4 +1158,31 @@ void ntoa(struct in_addr addr, char *ipaddr, int len)
bytes[3]);
}
+/**
+ * Build a string list from a given source string.
+ * This is usually used for parsing out values from the config file, but could
+ * be used for other things.
+ * NOTE: this function uses strtok(), be aware it will break any buffer you think you have in there ;)
+ **/
+char **buildStringList(char *src, int *number)
+{
+ char *s;
+ int i = 0;
+ char **list = NULL;
+
+ if (src) {
+ s = strtok(src, " ");
+ do {
+ if (s) {
+ i++;
+ list = realloc(list, sizeof(char *) * i);
+ list[i - 1] = sstrdup(s);
+ }
+ } while ((s = strtok(NULL, " ")));
+ }
+ *number = i; /* always zero it, even if we have no setters */
+ return list;
+}
+
+
/* EOF */