summaryrefslogtreecommitdiff
path: root/src/ctype/toupper.c
blob: d797e0c6b68942408290fb458120bb36d6a63f53 (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
30
31
#include <stdio.h>
#include <limits.h>
#include <stdio.h>
#include "_ctype.h"

/** convert a lowercase letter to uppercase **/

int toupper(int c)
{
	unsigned char *map = __get_locale()->lc_ctype.ctoupper;

	ASSERT_REPRESENTABLE(c, 0, UCHAR_MAX, unsigned char, EOF);

	if (c == EOF) {
		return EOF;
	}

	return map[c];
}

/***
converts a lowercase letter to its equivalent uppercase letter in the current
locale.
***/

/*
RETURN_SUCCESS(ARGUMENT(c) converted to uppercase)
RETURN_FAILURE(ARGUMENT(c), ARGUMENT(c) was not a lowercase letter or it has no equivalent upercase letter)
LC_CTYPE
STDC(1)
*/