summaryrefslogtreecommitdiffstats
path: root/lib/toupper.c
blob: 807eb38c5810301bbb6975fa072843db4afdc1d9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "string.h"

int
toupper(int c)
{
    if(c >= 'a' && c <= 'z')
        c -= ('a' - 'A');
    return c;
}

char*
stoupper(char *s)
{
    char *o = s;
    for(; *s != 0; s++)
        *s = toupper(*s);
    return o;
}

char*
sntoupper(char *s, size_t limit)
{
    for(size_t i = 0; i < limit; i++)
        s[i] = toupper(s[i]);
    return s;
}