1d8d0cebeSAndrey A. Chernov /* 2d8d0cebeSAndrey A. Chernov * Copyright (c) 1989, 1993 3d8d0cebeSAndrey A. Chernov * The Regents of the University of California. All rights reserved. 4d8d0cebeSAndrey A. Chernov * (c) UNIX System Laboratories, Inc. 5d8d0cebeSAndrey A. Chernov * All or some portions of this file are derived from material licensed 6d8d0cebeSAndrey A. Chernov * to the University of California by American Telephone and Telegraph 7d8d0cebeSAndrey A. Chernov * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8d8d0cebeSAndrey A. Chernov * the permission of UNIX System Laboratories, Inc. 9d8d0cebeSAndrey A. Chernov * 10d8d0cebeSAndrey A. Chernov * This code is derived from software contributed to Berkeley by 11d8d0cebeSAndrey A. Chernov * Paul Borman at Krystal Technologies. 12d8d0cebeSAndrey A. Chernov * 133c87aa1dSDavid Chisnall * Copyright (c) 2011 The FreeBSD Foundation 143c87aa1dSDavid Chisnall * All rights reserved. 153c87aa1dSDavid Chisnall * Portions of this software were developed by David Chisnall 163c87aa1dSDavid Chisnall * under sponsorship from the FreeBSD Foundation. 173c87aa1dSDavid Chisnall * 18d8d0cebeSAndrey A. Chernov * Redistribution and use in source and binary forms, with or without 19d8d0cebeSAndrey A. Chernov * modification, are permitted provided that the following conditions 20d8d0cebeSAndrey A. Chernov * are met: 21d8d0cebeSAndrey A. Chernov * 1. Redistributions of source code must retain the above copyright 22d8d0cebeSAndrey A. Chernov * notice, this list of conditions and the following disclaimer. 23d8d0cebeSAndrey A. Chernov * 2. Redistributions in binary form must reproduce the above copyright 24d8d0cebeSAndrey A. Chernov * notice, this list of conditions and the following disclaimer in the 25d8d0cebeSAndrey A. Chernov * documentation and/or other materials provided with the distribution. 26*fbbd9655SWarner Losh * 3. Neither the name of the University nor the names of its contributors 27d8d0cebeSAndrey A. Chernov * may be used to endorse or promote products derived from this software 28d8d0cebeSAndrey A. Chernov * without specific prior written permission. 29d8d0cebeSAndrey A. Chernov * 30d8d0cebeSAndrey A. Chernov * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 31d8d0cebeSAndrey A. Chernov * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 32d8d0cebeSAndrey A. Chernov * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 33d8d0cebeSAndrey A. Chernov * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 34d8d0cebeSAndrey A. Chernov * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 35d8d0cebeSAndrey A. Chernov * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 36d8d0cebeSAndrey A. Chernov * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 37d8d0cebeSAndrey A. Chernov * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 38d8d0cebeSAndrey A. Chernov * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 39d8d0cebeSAndrey A. Chernov * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 40d8d0cebeSAndrey A. Chernov * SUCH DAMAGE. 41d8d0cebeSAndrey A. Chernov */ 42d8d0cebeSAndrey A. Chernov 43d8d0cebeSAndrey A. Chernov #include <sys/cdefs.h> 44d8d0cebeSAndrey A. Chernov __FBSDID("$FreeBSD$"); 45d8d0cebeSAndrey A. Chernov 46d8d0cebeSAndrey A. Chernov #include <wchar.h> 473c87aa1dSDavid Chisnall #include <wctype.h> 483c87aa1dSDavid Chisnall #include <xlocale.h> 49d8d0cebeSAndrey A. Chernov 50de6c9c9dSTim J. Robbins #undef wcwidth 519424df44SAndrey A. Chernov 52d8d0cebeSAndrey A. Chernov int 531da6b56aSAndrey A. Chernov wcwidth(wchar_t wc) 54d8d0cebeSAndrey A. Chernov { 55de6c9c9dSTim J. Robbins return (__wcwidth(wc)); 56d8d0cebeSAndrey A. Chernov } 573c87aa1dSDavid Chisnall int 583c87aa1dSDavid Chisnall wcwidth_l(wchar_t wc, locale_t locale) 593c87aa1dSDavid Chisnall { 603c87aa1dSDavid Chisnall return (__wcwidth_l(wc, locale)); 613c87aa1dSDavid Chisnall } 62