~martanne/ciopfs

ref: v0.4 ciopfs/ascii.c -rw-r--r-- 349 bytes
15058fe4Marc Andre Tanner Set version to 0.4 9 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <ctype.h>

static inline bool str_contains_upper(const char *s)
{
	while (*s) {
		if (isupper(*s++))
			return true;
	}
	return false;
}

static inline char *str_fold(const char *src)
{
	char *t, *dest = malloc(strlen(src) + 1);
	if (!dest)
		return NULL;
	for (t = dest; *src; src++, t++)
		*t = tolower(*src);
	*t = '\0';
	return dest;
}