2003-10-23 Artem B. Bityuckiy <mail_lists@mail.ru>
* libc/string/wcsnlen.c: New file.
        * libc/include/wchar.h: Add wcsnlen prototype.
        * libc/string/Makefile.am: Add wcsnlen support.
        * libc/string/Makefile.in: Regenerated.
        * libc/string/wcstrings.tex: Add wcsnlen documentation.
			
			
This commit is contained in:
		| @@ -1,3 +1,11 @@ | ||||
| 2003-10-23  Artem B. Bityuckiy  <mail_lists@mail.ru> | ||||
|  | ||||
| 	* libc/string/wcsnlen.c: New file. | ||||
| 	* libc/include/wchar.h: Add wcsnlen prototype. | ||||
| 	* libc/string/Makefile.am: Add wcsnlen support. | ||||
| 	* libc/string/Makefile.in: Regenerated. | ||||
| 	* libc/string/wcstrings.tex: Add wcsnlen documentation. | ||||
|  | ||||
| 2003-10-22  Richard Sandiford  <rsandifo@redhat.com> | ||||
|  | ||||
| 	* libc/stdlib/exit.c (exit): Handle null _GLOBAL_REENT->_atexits. | ||||
|   | ||||
| @@ -58,6 +58,7 @@ size_t	_EXFUN(wcslen, (const wchar_t *)); | ||||
| wchar_t	*_EXFUN(wcsncat, (wchar_t * , const wchar_t * , size_t)); | ||||
| int	_EXFUN(wcsncmp, (const wchar_t *, const wchar_t *, size_t)); | ||||
| wchar_t	*_EXFUN(wcsncpy, (wchar_t *  , const wchar_t * , size_t)); | ||||
| size_t	_EXFUN(wcsnlen, (const wchar_t *, size_t)); | ||||
| wchar_t	*_EXFUN(wcspbrk, (const wchar_t *, const wchar_t *)); | ||||
| wchar_t	*_EXFUN(wcsrchr, (const wchar_t *, wchar_t)); | ||||
| size_t	_EXFUN(wcsspn, (const wchar_t *, const wchar_t *)); | ||||
|   | ||||
| @@ -57,6 +57,7 @@ GENERAL_SOURCES = \ | ||||
| 	wcsncat.c \ | ||||
| 	wcsncmp.c \ | ||||
| 	wcsncpy.c \ | ||||
| 	wcsnlen.c \ | ||||
| 	wcspbrk.c \ | ||||
| 	wcsrchr.c \ | ||||
| 	wcsspn.c \ | ||||
| @@ -109,10 +110,11 @@ strcasecmp.def	strncasecmp.def strlwr.def	strupr.def  memccpy.def \ | ||||
| mempcpy.def \ | ||||
| wcscat.def	wcschr.def	wcscmp.def	wcscoll.def \ | ||||
| wcscpy.def	wcscspn.def \ | ||||
| wcslcat.def	wcslcpy.def	wcslen.def	wcsncat.def wcsncmp.def \ | ||||
| wcsncpy.def	wcspbrk.def	wcsrchr.def	wcsspn.def wcsstr.def \ | ||||
| wcswidth.def	wcwidth.def	wmemchr.def	wmemcmp.def wmemcpy.def \ | ||||
| wmemmove.def	wmemset.def | ||||
| wcslcat.def	wcslcpy.def	wcslen.def	wcsncat.def \ | ||||
| wcsncmp.def	wcsncpy.def	wcsnlen.def	wcspbrk.def \ | ||||
| wcsrchr.def	wcsspn.def	wcsstr.def \ | ||||
| wcswidth.def	wcwidth.def	wmemchr.def \ | ||||
| wmemcmp.def	wmemcpy.def	wmemmove.def	wmemset.def | ||||
|  | ||||
| SUFFIXES = .def | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| # Makefile.in generated automatically by automake 1.4 from Makefile.am | ||||
| # Makefile.in generated automatically by automake 1.4-p5 from Makefile.am | ||||
|  | ||||
| # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. | ||||
| # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. | ||||
| # This Makefile.in is free software; the Free Software Foundation | ||||
| # gives unlimited permission to copy and/or distribute it, | ||||
| # with or without modifications, as long as this notice is preserved. | ||||
| @@ -163,6 +163,7 @@ GENERAL_SOURCES = \ | ||||
| 	wcsncat.c \ | ||||
| 	wcsncmp.c \ | ||||
| 	wcsncpy.c \ | ||||
| 	wcsnlen.c \ | ||||
| 	wcspbrk.c \ | ||||
| 	wcsrchr.c \ | ||||
| 	wcsspn.c \ | ||||
| @@ -207,10 +208,11 @@ strcasecmp.def	strncasecmp.def strlwr.def	strupr.def  memccpy.def \ | ||||
| mempcpy.def \ | ||||
| wcscat.def	wcschr.def	wcscmp.def	wcscoll.def \ | ||||
| wcscpy.def	wcscspn.def \ | ||||
| wcslcat.def	wcslcpy.def	wcslen.def	wcsncat.def wcsncmp.def \ | ||||
| wcsncpy.def	wcspbrk.def	wcsrchr.def	wcsspn.def wcsstr.def \ | ||||
| wcswidth.def	wcwidth.def	wmemchr.def	wmemcmp.def wmemcpy.def \ | ||||
| wmemmove.def	wmemset.def | ||||
| wcslcat.def	wcslcpy.def	wcslen.def	wcsncat.def \ | ||||
| wcsncmp.def	wcsncpy.def	wcsnlen.def	wcspbrk.def \ | ||||
| wcsrchr.def	wcsspn.def	wcsstr.def \ | ||||
| wcswidth.def	wcwidth.def	wmemchr.def \ | ||||
| wmemcmp.def	wmemcpy.def	wmemmove.def	wmemset.def | ||||
|  | ||||
|  | ||||
| SUFFIXES = .def | ||||
| @@ -248,10 +250,12 @@ LIBS = @LIBS@ | ||||
| @USE_LIBTOOL_FALSE@wcscpy.$(OBJEXT) wcscspn.$(OBJEXT) wcslcat.$(OBJEXT) \ | ||||
| @USE_LIBTOOL_FALSE@wcslcpy.$(OBJEXT) wcslen.$(OBJEXT) wcsncat.$(OBJEXT) \ | ||||
| @USE_LIBTOOL_FALSE@wcsncmp.$(OBJEXT) wcsncpy.$(OBJEXT) \ | ||||
| @USE_LIBTOOL_FALSE@wcspbrk.$(OBJEXT) wcsrchr.$(OBJEXT) wcsspn.$(OBJEXT) \ | ||||
| @USE_LIBTOOL_FALSE@wcsstr.$(OBJEXT) wcswidth.$(OBJEXT) wcwidth.$(OBJEXT) \ | ||||
| @USE_LIBTOOL_FALSE@wmemchr.$(OBJEXT) wmemcmp.$(OBJEXT) wmemcpy.$(OBJEXT) \ | ||||
| @USE_LIBTOOL_FALSE@wmemmove.$(OBJEXT) wmemset.$(OBJEXT) | ||||
| @USE_LIBTOOL_FALSE@wcsnlen.$(OBJEXT) wcspbrk.$(OBJEXT) \ | ||||
| @USE_LIBTOOL_FALSE@wcsrchr.$(OBJEXT) wcsspn.$(OBJEXT) wcsstr.$(OBJEXT) \ | ||||
| @USE_LIBTOOL_FALSE@wcswidth.$(OBJEXT) wcwidth.$(OBJEXT) \ | ||||
| @USE_LIBTOOL_FALSE@wmemchr.$(OBJEXT) wmemcmp.$(OBJEXT) \ | ||||
| @USE_LIBTOOL_FALSE@wmemcpy.$(OBJEXT) wmemmove.$(OBJEXT) \ | ||||
| @USE_LIBTOOL_FALSE@wmemset.$(OBJEXT) | ||||
| LTLIBRARIES =  $(noinst_LTLIBRARIES) | ||||
|  | ||||
| @USE_LIBTOOL_TRUE@libstring_la_OBJECTS =  bcopy.lo bzero.lo index.lo \ | ||||
| @@ -265,9 +269,10 @@ LTLIBRARIES =  $(noinst_LTLIBRARIES) | ||||
| @USE_LIBTOOL_TRUE@strupr.lo strxfrm.lo strstr.lo swab.lo u_strerr.lo \ | ||||
| @USE_LIBTOOL_TRUE@wcscat.lo wcschr.lo wcscmp.lo wcscoll.lo wcscpy.lo \ | ||||
| @USE_LIBTOOL_TRUE@wcscspn.lo wcslcat.lo wcslcpy.lo wcslen.lo wcsncat.lo \ | ||||
| @USE_LIBTOOL_TRUE@wcsncmp.lo wcsncpy.lo wcspbrk.lo wcsrchr.lo wcsspn.lo \ | ||||
| @USE_LIBTOOL_TRUE@wcsstr.lo wcswidth.lo wcwidth.lo wmemchr.lo wmemcmp.lo \ | ||||
| @USE_LIBTOOL_TRUE@wmemcpy.lo wmemmove.lo wmemset.lo | ||||
| @USE_LIBTOOL_TRUE@wcsncmp.lo wcsncpy.lo wcsnlen.lo wcspbrk.lo \ | ||||
| @USE_LIBTOOL_TRUE@wcsrchr.lo wcsspn.lo wcsstr.lo wcswidth.lo wcwidth.lo \ | ||||
| @USE_LIBTOOL_TRUE@wmemchr.lo wmemcmp.lo wmemcpy.lo wmemmove.lo \ | ||||
| @USE_LIBTOOL_TRUE@wmemset.lo | ||||
| CFLAGS = @CFLAGS@ | ||||
| COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) | ||||
| LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) | ||||
|   | ||||
							
								
								
									
										74
									
								
								newlib/libc/string/wcsnlen.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								newlib/libc/string/wcsnlen.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,74 @@ | ||||
| /*  | ||||
| FUNCTION | ||||
|         <<wcsnlen>>---get fixed-size wide character string length | ||||
|      | ||||
| INDEX | ||||
|         wcsnlen | ||||
|  | ||||
| ANSI_SYNOPSIS | ||||
|         #include <wchar.h> | ||||
|         size_t wcsnlen(const wchar_t *<[s]>, size_t <[maxlen]>); | ||||
|  | ||||
| TRAD_SYNOPSIS | ||||
|         #include <wchar.h> | ||||
|         size_t wcsnlen(<[s]>, <[maxlen]>) | ||||
|         wchar_t *<[s]>; | ||||
|         size_t <[maxlen]>; | ||||
|  | ||||
| DESCRIPTION | ||||
|         The <<wcsnlen>> function computes the number of wide character codes | ||||
|         in the wide character string pointed to by <[s]> not including the | ||||
|         terminating L'\0' wide character but at most <[maxlen]> wide | ||||
|         characters. | ||||
|  | ||||
| RETURNS | ||||
|         <<wcsnlen>> returns the length of <[s]> if it is less then <[maxlen]>, | ||||
|         or <[maxlen]> if there is no L'\0' wide character in first <[maxlen]> | ||||
|         characters. | ||||
|  | ||||
| PORTABILITY | ||||
| <<wcsnlen>> is GNU extension.. | ||||
| <<wcsnlen>> requires no supporting OS subroutines. | ||||
| */ | ||||
|  | ||||
| /* | ||||
|  * Copyright (c) 2003, Artem B. Bityuckiy (dedekind@mail.ru). | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without | ||||
|  * modification, are permitted provided that the above copyright notice, | ||||
|  * this condition statement, and the following disclaimer are retained | ||||
|  * in any redistributions of the source code. | ||||
|  * | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | ||||
|  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||||
|  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||||
|  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||||
|  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||||
|  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||||
|  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||
|  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
|  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
|  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
|  * SUCH DAMAGE. | ||||
|  */ | ||||
|  | ||||
| #include <_ansi.h> | ||||
| #include <sys/types.h> | ||||
| #include <wchar.h> | ||||
|  | ||||
| size_t | ||||
| _DEFUN(wcsnlen, (s, maxlen),  | ||||
|                  _CONST wchar_t *s _AND  | ||||
|                  size_t maxlen) | ||||
| { | ||||
|   _CONST wchar_t *p; | ||||
|  | ||||
|   p = s; | ||||
|   while (*p && maxlen-- > 0) | ||||
|     p++; | ||||
|  | ||||
|   return (size_t)(p - s); | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| @@ -23,6 +23,7 @@ declarations are in @file{wchar.h}. | ||||
| * wcsncat::     Concatenate wide-character strings | ||||
| * wcsncmp::     Wide-character string compare | ||||
| * wcsncpy::     Counted copy wide-character string | ||||
| * wcsnlen::     Wide-character string length with maximum limit | ||||
| * wcspbrk::     Find wide-chars in string | ||||
| * wcsrchr::     Reverse search for wide-character in string | ||||
| * wcsspn::      Find initial match in wide-character string | ||||
| @@ -82,6 +83,9 @@ declarations are in @file{wchar.h}. | ||||
| @page | ||||
| @include string/wcsncpy.def | ||||
|  | ||||
| @page | ||||
| @include string/wcsnlen.def | ||||
|  | ||||
| @page | ||||
| @include string/wcspbrk.def | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user