chiark / gitweb /
bootctl: move toupper() implementation to string-util.h
[elogind.git] / src / basic / string-util.c
index 293a15f9c041cf59f5354829cfdc86b0b0622a20..e9856b90d39215ac3e6e952f0966a362f8c5b5a1 100644 (file)
@@ -323,6 +323,14 @@ char ascii_tolower(char x) {
         return x;
 }
 
+char ascii_toupper(char x) {
+
+        if (x >= 'a' && x <= 'z')
+                return x - 'a' + 'A';
+
+        return x;
+}
+
 char *ascii_strlower(char *t) {
         char *p;
 
@@ -334,6 +342,17 @@ char *ascii_strlower(char *t) {
         return t;
 }
 
+char *ascii_strupper(char *t) {
+        char *p;
+
+        assert(t);
+
+        for (p = t; *p; p++)
+                *p = ascii_toupper(*p);
+
+        return t;
+}
+
 char *ascii_strlower_n(char *t, size_t n) {
         size_t i;