commit 648f730f5d7d3f2cd24e4d88b785d9fa8c28d3e9
parent 3697b0d1cce2223c9d094830776cf3cf282c3b7f
Author: Frederic Cambus <fred@statdns.com>
Date: Thu, 3 Jan 2019 12:41:45 +0100
Add an strtolower() function, will be used to normalize RR types.
Diffstat:
2 files changed, 45 insertions(+), 0 deletions(-)
diff --git a/src/strtolower.c b/src/strtolower.c
@@ -0,0 +1,27 @@
+/*
+ * StatZone
+ * Copyright (c) 2012-2019, Frederic Cambus
+ * https://www.statdns.com
+ *
+ * Created: 2012-02-13
+ * Last Updated: 2019-01-03
+ *
+ * StatZone is released under the BSD 2-Clause license
+ * See LICENSE file for details.
+ */
+
+#include <ctype.h>
+#include "strtolower.h"
+
+char *
+strtolower(char *str)
+{
+ char *p = str;
+
+ while (*p) {
+ *p = tolower((unsigned char)*p);
+ p++;
+ }
+
+ return str;
+}
diff --git a/src/strtolower.h b/src/strtolower.h
@@ -0,0 +1,18 @@
+/*
+ * StatZone
+ * Copyright (c) 2012-2019, Frederic Cambus
+ * https://www.statdns.com
+ *
+ * Created: 2012-02-13
+ * Last Updated: 2019-01-03
+ *
+ * StatZone is released under the BSD 2-Clause license
+ * See LICENSE file for details.
+ */
+
+#ifndef STRTOLOWER_H
+#define STRTOLOWER_H
+
+char *strtolower(char *);
+
+#endif /* STRTOLOWER_H */