summary refs log tree commit diff stats
path: root/src/common/util.c
diff options
context:
space:
mode:
authorBerke Viktor <berkeviktor@aol.com>2011-11-29 20:15:56 +0100
committerBerke Viktor <berkeviktor@aol.com>2011-11-29 20:15:56 +0100
commitb16ca3fa64fc1fa83d40d00d0090cc7fd27a9840 (patch)
treef7eac0939e9afe2d72cf2208c42f0e9a5e7de4a4 /src/common/util.c
parent266a86d0b5383db9a998b9b6412947fbbdac58a1 (diff)
initial plugin config framework, can't save multiple entries
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 870f4d5c..c16d41f5 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -1830,3 +1830,21 @@ safe_strcpy (char *dest, const char *src, int bytes_left)
 		}
 	}
 }
+
+void
+canonalize_key (char *key)
+{
+	char *pos, token;
+
+	for (pos = key; (token = *pos) != 0; pos++)
+	{
+		if (token != '_' && (token < '0' || token > '9') && (token < 'A' || token > 'Z') && (token < 'a' || token > 'z'))
+		{
+			*pos = '_';
+		}
+		else
+		{
+			*pos = tolower(token);
+		}
+	}
+}