wctrans.c (d390e53270d48bf9dfefd11700e40a2db0abdd4e) wctrans.c (4645079944183e75b2d56f8481c1b3a4b28b0975)
1/*-
2 * Copyright (c) 2002 Tim J. Robbins.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD$");
29
1/*-
2 * Copyright (c) 2002 Tim J. Robbins.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD$");
29
30#include <ctype.h>
30#include <errno.h>
31#include <string.h>
32#include <wctype.h>
33
34enum {
35 _WCT_ERROR = 0,
36 _WCT_TOLOWER = 1,
37 _WCT_TOUPPER = 2
38};
39
31#include <errno.h>
32#include <string.h>
33#include <wctype.h>
34
35enum {
36 _WCT_ERROR = 0,
37 _WCT_TOLOWER = 1,
38 _WCT_TOUPPER = 2
39};
40
41/*
42 * TODO: Supply a macro version of this.
43 */
40wint_t
41towctrans(wint_t wc, wctrans_t desc)
42{
43
44 switch (desc) {
45 case _WCT_TOLOWER:
44wint_t
45towctrans(wint_t wc, wctrans_t desc)
46{
47
48 switch (desc) {
49 case _WCT_TOLOWER:
46 wc = towlower(wc);
50 wc = tolower(wc);
47 break;
48 case _WCT_TOUPPER:
51 break;
52 case _WCT_TOUPPER:
49 wc = towupper(wc);
53 wc = toupper(wc);
50 break;
51 case _WCT_ERROR:
52 default:
53 errno = EINVAL;
54 break;
55 }
56
57 return (wc);

--- 23 unchanged lines hidden ---
54 break;
55 case _WCT_ERROR:
56 default:
57 errno = EINVAL;
58 break;
59 }
60
61 return (wc);

--- 23 unchanged lines hidden ---