X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/c0acc0f522e63f249a47bb354a83e518740b54bd..c47495657bb2f35012e35668a2c6c149e1bed3ac:/lib/mbswidth.c diff --git a/lib/mbswidth.c b/lib/mbswidth.c index 9d5ebe74..21d96a23 100644 --- a/lib/mbswidth.c +++ b/lib/mbswidth.c @@ -1,5 +1,5 @@ /* Determine the number of screen columns needed for a string. - Copyright (C) 2000-2001 Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,6 +21,15 @@ # include #endif +/* Get mbstate_t, mbrtowc(), mbsinit(), wcwidth(). This must be + included before "mbswidth.h", because UnixWare 7.1.1 + declares its own mbswidth and we want mbswidth.h's "#define + mbswidth gnu_mbswidth" to take effect after is + included. */ +#if HAVE_WCHAR_H +# include +#endif + /* Specification. */ #include "mbswidth.h" @@ -32,11 +41,6 @@ /* Get isprint(). */ #include -/* Get mbstate_t, mbrtowc(), mbsinit(), wcwidth(). */ -#if HAVE_WCHAR_H -# include -#endif - /* Get iswprint(), iswcntrl(). */ #if HAVE_WCTYPE_H # include @@ -87,9 +91,7 @@ int wcwidth (); With flags = MBSW_REJECT_INVALID | MBSW_REJECT_UNPRINTABLE, this is the multibyte analogon of the wcswidth function. */ int -mbswidth (string, flags) - const char *string; - int flags; +mbswidth (const char *string, int flags) { return mbsnwidth (string, strlen (string), flags); } @@ -99,10 +101,7 @@ mbswidth (string, flags) non-printable character occurs, and MBSW_REJECT_UNPRINTABLE is specified, -1 is returned. */ int -mbsnwidth (string, nbytes, flags) - const char *string; - size_t nbytes; - int flags; +mbsnwidth (const char *string, size_t nbytes, int flags) { const char *p = string; const char *plimit = p + nbytes;