summaryrefslogtreecommitdiff
path: root/functions.c
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-07-10 20:44:35 +0100
committerLuke Bratch <luke@bratch.co.uk>2019-07-10 20:44:35 +0100
commitb9a8951cf86214a3dcb430ae0d34e8d5dc1adb11 (patch)
treef868ace1f3e1763279eb513a49c3fdee9d3c0fab /functions.c
parent22a4f361329ed4e303e2f1bdce9edf49e70970f3 (diff)
Ensure log filenames are safe for writing.
Diffstat (limited to 'functions.c')
-rw-r--r--functions.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/functions.c b/functions.c
index 8bbc213..938b8b1 100644
--- a/functions.c
+++ b/functions.c
@@ -1253,3 +1253,12 @@ int getclientcodetime(char *code, struct clientcodes *clientcodes) {
// If we got here, the code was never found
return 0;
}
+
+// Replace any instances of "find" with "replace" in the string "str"
+void replacechar(char *str, char find, char replace) {
+ for (size_t i = 0; i < strlen(str); i++) {
+ if (str[i] == find) {
+ str[i] = replace;
+ }
+ }
+}