diff options
Diffstat (limited to 'utility/util.c')
-rw-r--r-- | utility/util.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/utility/util.c b/utility/util.c new file mode 100644 index 0000000..ef3ea68 --- /dev/null +++ b/utility/util.c | |||
@@ -0,0 +1,28 @@ | |||
1 | #include "util.h" | ||
2 | #include "apr_strings.h" | ||
3 | #include "apr_lib.h" | ||
4 | |||
5 | |||
6 | char *lowerstr(apr_pool_t *pool, const char *input) | ||
7 | { | ||
8 | char *temp; | ||
9 | char *itr; | ||
10 | temp = apr_pstrdup(pool, input); | ||
11 | for (itr=temp; *itr!='\0'; itr++) { | ||
12 | *itr = apr_tolower(*itr); | ||
13 | } | ||
14 | return temp; | ||
15 | } | ||
16 | |||
17 | void line_chomp(char *str) | ||
18 | { | ||
19 | int len; | ||
20 | // chomp off newline | ||
21 | len = strlen(str); | ||
22 | if (len) { | ||
23 | while (str[len-1] == '\r' || str[len-1] == '\n') { | ||
24 | str[len-1] = '\0'; | ||
25 | len--; | ||
26 | } | ||
27 | } | ||
28 | } | ||