summaryrefslogtreecommitdiff
path: root/reference/C/CONTRIB/SNIP/strupr.c
blob: a4bca57a9c3ece4179938a041679a8e7d32807b9 (plain)
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
27
28
29
/*
**  Portable, public domain strupr() & strlwr()
*/

#include <ctype.h>

char *strupr(char *str)
{
      char *string = str;

      if (str)
      {
            for ( ; *str; ++str)
                  *str = toupper(*str);
      }
      return string;
}

char *strlwr(char *str)
{
      char *string = str;

      if (str)
      {
            for ( ; *str; ++str)
                  *str = tolower(*str);
      }
      return string;
}