1*f2d34afaSRobert Mustacchi /*
2*f2d34afaSRobert Mustacchi  * This file and its contents are supplied under the terms of the
3*f2d34afaSRobert Mustacchi  * Common Development and Distribution License ("CDDL"), version 1.0.
4*f2d34afaSRobert Mustacchi  * You may only use this file in accordance with the terms of version
5*f2d34afaSRobert Mustacchi  * 1.0 of the CDDL.
6*f2d34afaSRobert Mustacchi  *
7*f2d34afaSRobert Mustacchi  * A full copy of the text of the CDDL should have accompanied this
8*f2d34afaSRobert Mustacchi  * source.  A copy of the CDDL is also available via the Internet at
9*f2d34afaSRobert Mustacchi  * http://www.illumos.org/license/CDDL.
10*f2d34afaSRobert Mustacchi  */
11*f2d34afaSRobert Mustacchi 
12*f2d34afaSRobert Mustacchi /*
13*f2d34afaSRobert Mustacchi  * Copyright 2016 Joyent, Inc.
14*f2d34afaSRobert Mustacchi  */
15*f2d34afaSRobert Mustacchi 
16*f2d34afaSRobert Mustacchi /*
17*f2d34afaSRobert Mustacchi  * Regression test for illumos#7344. Make sure that wcsncasecmp() only checks
18*f2d34afaSRobert Mustacchi  * the specified number of bytes.
19*f2d34afaSRobert Mustacchi  */
20*f2d34afaSRobert Mustacchi 
21*f2d34afaSRobert Mustacchi #include <wchar.h>
22*f2d34afaSRobert Mustacchi #include <string.h>
23*f2d34afaSRobert Mustacchi #include <strings.h>
24*f2d34afaSRobert Mustacchi #include <stdlib.h>
25*f2d34afaSRobert Mustacchi #include <sys/debug.h>
26*f2d34afaSRobert Mustacchi 
27*f2d34afaSRobert Mustacchi int
main(void)28*f2d34afaSRobert Mustacchi main(void)
29*f2d34afaSRobert Mustacchi {
30*f2d34afaSRobert Mustacchi 	wchar_t a[8], b[8];
31*f2d34afaSRobert Mustacchi 
32*f2d34afaSRobert Mustacchi 	(void) memset(a, 'a', sizeof (a));
33*f2d34afaSRobert Mustacchi 	(void) memset(b, 'a', sizeof (b));
34*f2d34afaSRobert Mustacchi 
35*f2d34afaSRobert Mustacchi 	a[7] = 'n';
36*f2d34afaSRobert Mustacchi 	b[7] = 'o';
37*f2d34afaSRobert Mustacchi 
38*f2d34afaSRobert Mustacchi 	VERIFY0(wcsncasecmp(a, b, 7));
39*f2d34afaSRobert Mustacchi 	return (0);
40*f2d34afaSRobert Mustacchi }
41