* libc/include/wchar.h: Add prototypes for wcpcpy and wcpncpy.
* libc/string/Makefile.am (ELIX_SOURCES): Add wcpcpy.c and wcpncpy.c. (CHEWOUT_FILES): Add wcpcpy.def and wcpncpy.def. * libc/string/Makefile.in: Regenerate. * libc/string/wcpcpy.c: New file. * libc/string/wcpncpy.c: New file. * libc/string/wcstrings.tex: Add wcpcpy and wcpncpy.
This commit is contained in:
parent
478df8bb91
commit
ac26b72723
@ -1,3 +1,14 @@
|
||||
2007-12-19 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* libc/include/wchar.h: Add prototypes for wcpcpy and wcpncpy.
|
||||
* libc/string/Makefile.am (ELIX_SOURCES): Add wcpcpy.c and
|
||||
wcpncpy.c.
|
||||
(CHEWOUT_FILES): Add wcpcpy.def and wcpncpy.def.
|
||||
* libc/string/Makefile.in: Regenerate.
|
||||
* libc/string/wcpcpy.c: New file.
|
||||
* libc/string/wcpncpy.c: New file.
|
||||
* libc/string/wcstrings.tex: Add wcpcpy and wcpncpy.
|
||||
|
||||
2007-12-19 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* libc/stdio/vfprintf.c (_VFPRINTF_R): Use correct pointer in call to
|
||||
|
@ -58,6 +58,7 @@ wchar_t *_EXFUN(wcschr, (const wchar_t *, wchar_t));
|
||||
int _EXFUN(wcscmp, (const wchar_t *, const wchar_t *));
|
||||
int _EXFUN(wcscoll, (const wchar_t *, const wchar_t *));
|
||||
wchar_t *_EXFUN(wcscpy, (wchar_t * , const wchar_t *));
|
||||
wchar_t *_EXFUN(wcpcpy, (wchar_t * , const wchar_t *));
|
||||
size_t _EXFUN(wcscspn, (const wchar_t *, const wchar_t *));
|
||||
size_t _EXFUN(wcslcat, (wchar_t *, const wchar_t *, size_t));
|
||||
size_t _EXFUN(wcslcpy, (wchar_t *, const wchar_t *, size_t));
|
||||
@ -65,6 +66,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));
|
||||
wchar_t *_EXFUN(wcpncpy, (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));
|
||||
|
@ -82,7 +82,9 @@ ELIX_SOURCES = \
|
||||
stpncpy.c \
|
||||
strndup.c \
|
||||
strcasestr.c \
|
||||
strndup_r.c
|
||||
strndup_r.c \
|
||||
wcpcpy.c \
|
||||
wcpncpy.c \
|
||||
endif
|
||||
|
||||
libstring_la_LDFLAGS = -Xcompiler -nostdlib
|
||||
@ -110,7 +112,7 @@ memcmp.def strchr.def strlen.def strnlen.def strspn.def \
|
||||
strcasecmp.def strncasecmp.def strcasestr.def strlwr.def strupr.def \
|
||||
memccpy.def mempcpy.def stpcpy.def stpncpy.def \
|
||||
wcscat.def wcschr.def wcscmp.def wcscoll.def \
|
||||
wcscpy.def wcscspn.def \
|
||||
wcscpy.def wcscspn.def wcpcpy.def wcpncpy.def \
|
||||
wcslcat.def wcslcpy.def wcslen.def wcsncat.def \
|
||||
wcsncmp.def wcsncpy.def wcsnlen.def wcspbrk.def \
|
||||
wcsrchr.def wcsspn.def wcsstr.def \
|
||||
|
@ -95,7 +95,9 @@ am__objects_1 = lib_a-bcopy.$(OBJEXT) lib_a-bzero.$(OBJEXT) \
|
||||
@ELIX_LEVEL_1_FALSE@ lib_a-stpncpy.$(OBJEXT) \
|
||||
@ELIX_LEVEL_1_FALSE@ lib_a-strndup.$(OBJEXT) \
|
||||
@ELIX_LEVEL_1_FALSE@ lib_a-strcasestr.$(OBJEXT) \
|
||||
@ELIX_LEVEL_1_FALSE@ lib_a-strndup_r.$(OBJEXT)
|
||||
@ELIX_LEVEL_1_FALSE@ lib_a-strndup_r.$(OBJEXT) \
|
||||
@ELIX_LEVEL_1_FALSE@ lib_a-wcpcpy.$(OBJEXT) \
|
||||
@ELIX_LEVEL_1_FALSE@ lib_a-wcpncpy.$(OBJEXT)
|
||||
@USE_LIBTOOL_FALSE@am_lib_a_OBJECTS = $(am__objects_1) \
|
||||
@USE_LIBTOOL_FALSE@ $(am__objects_2)
|
||||
lib_a_OBJECTS = $(am_lib_a_OBJECTS)
|
||||
@ -116,7 +118,8 @@ am__objects_3 = bcopy.lo bzero.lo index.lo memchr.lo memcmp.lo \
|
||||
wmemcpy.lo wmemmove.lo wmemset.lo
|
||||
@ELIX_LEVEL_1_FALSE@am__objects_4 = bcmp.lo memccpy.lo mempcpy.lo \
|
||||
@ELIX_LEVEL_1_FALSE@ stpcpy.lo stpncpy.lo strndup.lo \
|
||||
@ELIX_LEVEL_1_FALSE@ strcasestr.lo strndup_r.lo
|
||||
@ELIX_LEVEL_1_FALSE@ strcasestr.lo strndup_r.lo wcpcpy.lo \
|
||||
@ELIX_LEVEL_1_FALSE@ wcpncpy.lo
|
||||
@USE_LIBTOOL_TRUE@am_libstring_la_OBJECTS = $(am__objects_3) \
|
||||
@USE_LIBTOOL_TRUE@ $(am__objects_4)
|
||||
libstring_la_OBJECTS = $(am_libstring_la_OBJECTS)
|
||||
@ -371,7 +374,9 @@ GENERAL_SOURCES = \
|
||||
@ELIX_LEVEL_1_FALSE@ mempcpy.c \
|
||||
@ELIX_LEVEL_1_FALSE@ strndup.c \
|
||||
@ELIX_LEVEL_1_FALSE@ strcasestr.c \
|
||||
@ELIX_LEVEL_1_FALSE@ strndup_r.c
|
||||
@ELIX_LEVEL_1_FALSE@ strndup_r.c \
|
||||
@ELIX_LEVEL_1_FALSE@ wcpcpy.c \
|
||||
@ELIX_LEVEL_1_FALSE@ wcpncpy.c
|
||||
|
||||
@ELIX_LEVEL_1_TRUE@ELIX_SOURCES =
|
||||
libstring_la_LDFLAGS = -Xcompiler -nostdlib
|
||||
@ -392,7 +397,7 @@ memcmp.def strchr.def strlen.def strnlen.def strspn.def \
|
||||
strcasecmp.def strncasecmp.def strcasestr.def strlwr.def strupr.def \
|
||||
memccpy.def mempcpy.def stpcpy.def stpncpy.def \
|
||||
wcscat.def wcschr.def wcscmp.def wcscoll.def \
|
||||
wcscpy.def wcscspn.def \
|
||||
wcscpy.def wcscspn.def wcpcpy.def wcpncpy.def \
|
||||
wcslcat.def wcslcpy.def wcslen.def wcsncat.def \
|
||||
wcsncmp.def wcsncpy.def wcsnlen.def wcspbrk.def \
|
||||
wcsrchr.def wcsspn.def wcsstr.def \
|
||||
@ -908,6 +913,18 @@ lib_a-strndup_r.o: strndup_r.c
|
||||
lib_a-strndup_r.obj: strndup_r.c
|
||||
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strndup_r.obj `if test -f 'strndup_r.c'; then $(CYGPATH_W) 'strndup_r.c'; else $(CYGPATH_W) '$(srcdir)/strndup_r.c'; fi`
|
||||
|
||||
lib_a-wcpcpy.o: wcpcpy.c
|
||||
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wcpcpy.o `test -f 'wcpcpy.c' || echo '$(srcdir)/'`wcpcpy.c
|
||||
|
||||
lib_a-wcpcpy.obj: wcpcpy.c
|
||||
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wcpcpy.obj `if test -f 'wcpcpy.c'; then $(CYGPATH_W) 'wcpcpy.c'; else $(CYGPATH_W) '$(srcdir)/wcpcpy.c'; fi`
|
||||
|
||||
lib_a-wcpncpy.o: wcpncpy.c
|
||||
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wcpncpy.o `test -f 'wcpncpy.c' || echo '$(srcdir)/'`wcpncpy.c
|
||||
|
||||
lib_a-wcpncpy.obj: wcpncpy.c
|
||||
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wcpncpy.obj `if test -f 'wcpncpy.c'; then $(CYGPATH_W) 'wcpncpy.c'; else $(CYGPATH_W) '$(srcdir)/wcpncpy.c'; fi`
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
|
41
newlib/libc/string/wcpcpy.c
Normal file
41
newlib/libc/string/wcpcpy.c
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
FUNCTION
|
||||
<<wcpcpy>>---copy a wide-character string returning a pointer to its end
|
||||
|
||||
ANSI_SYNOPSIS
|
||||
#include <wchar.h>
|
||||
wchar_t *wcpcpy(wchar_t *<[s1]>, const wchar_t *,<[s2]>);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
wchar_t *wcpcpy(<[s1]>, <[s2]>
|
||||
wchar_t *<[s1]>;
|
||||
const wchar_t *<[s2]>;
|
||||
|
||||
DESCRIPTION
|
||||
The <<wcpcpy>> function copies the wide-character string pointed to by
|
||||
<[s2]> (including the terminating null wide-character code) into the
|
||||
array pointed to by <[s1]>. If copying takes place between objects that
|
||||
overlap, the behaviour is undefined.
|
||||
|
||||
RETURNS
|
||||
This function returns a pointer to the end of the destination string,
|
||||
thus pointing to the trailing '\0'.
|
||||
|
||||
PORTABILITY
|
||||
<<wcpcpy>> is a GNU extension.
|
||||
|
||||
No supporting OS subroutines are required.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <wchar.h>
|
||||
|
||||
wchar_t *
|
||||
_DEFUN (wcpcpy, (s1, s2),
|
||||
wchar_t * s1 _AND
|
||||
_CONST wchar_t * s2)
|
||||
{
|
||||
while ((*s1++ = *s2++))
|
||||
;
|
||||
return --s1;
|
||||
}
|
61
newlib/libc/string/wcpncpy.c
Normal file
61
newlib/libc/string/wcpncpy.c
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
FUNCTION
|
||||
<<wcpncpy>>---copy part of a wide-character string returning a pointer to its end
|
||||
|
||||
ANSI_SYNOPSIS
|
||||
#include <wchar.h>
|
||||
wchar_t *wcpncpy(wchar_t *<[s1]>, const wchar_t *<[s2]>, size_t <[n]>);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
wchar_t *wcpncpy(<[s1]>, <[s2]>, <[n]>
|
||||
wchar_t *<[s1]>;
|
||||
const wchar_t *<[s2]>;
|
||||
size_t <[n]>;
|
||||
|
||||
DESCRIPTION
|
||||
The <<wcpncpy>> function copies not more than n wide-character codes
|
||||
(wide-character codes that follow a null wide-character code are not
|
||||
copied) from the array pointed to by <[s2]> to the array pointed to
|
||||
by <[s1]>. If copying takes place between objects that overlap, the
|
||||
behaviour is undefined.
|
||||
|
||||
If the array pointed to by <[s2]> is a wide-character string that is
|
||||
shorter than <[n]> wide-character codes, null wide-character codes are
|
||||
appended to the copy in the array pointed to by <[s1]>, until <[n]>
|
||||
wide-character codes in all are written.
|
||||
|
||||
RETURNS
|
||||
The <<wcpncpy>> function returns <[s1]>; no return value is reserved to
|
||||
indicate an error.
|
||||
|
||||
PORTABILITY
|
||||
<<wcpncpy>> is ISO/IEC 9899/AMD1:1995 (ISO C).
|
||||
|
||||
No supporting OS subroutines are required.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <wchar.h>
|
||||
|
||||
wchar_t *
|
||||
_DEFUN (wcpncpy, (dst, src, count),
|
||||
wchar_t * dst _AND
|
||||
_CONST wchar_t * src _AND
|
||||
size_t count)
|
||||
{
|
||||
wchar_t *ret = NULL;
|
||||
|
||||
while (count > 0)
|
||||
{
|
||||
--count;
|
||||
if ((*dst++ = *src++) == L'\0')
|
||||
{
|
||||
ret = dst - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (count-- > 0)
|
||||
*dst++ = L'\0';
|
||||
|
||||
return ret ? ret : dst;
|
||||
}
|
@ -16,6 +16,7 @@ declarations are in @file{wchar.h}.
|
||||
* wcscmp:: Wide-character string compare
|
||||
* wcscoll:: Locale-specific wide-character string compare
|
||||
* wcscpy:: Copy wide-character string
|
||||
* wcpcpy:: Copy a wide-character string returning a pointer to its end
|
||||
* wcscspn:: Count wide characters not in string
|
||||
* wcslcat:: Concatenate wide-character strings to specified length
|
||||
* wcslcpy:: Copy wide-character string to specified length
|
||||
@ -23,6 +24,7 @@ declarations are in @file{wchar.h}.
|
||||
* wcsncat:: Concatenate wide-character strings
|
||||
* wcsncmp:: Wide-character string compare
|
||||
* wcsncpy:: Counted copy wide-character string
|
||||
* wcpncpy:: Copy part of a wide-character string returning a pointer to its end
|
||||
* wcsnlen:: Wide-character string length with maximum limit
|
||||
* wcspbrk:: Find wide characters in string
|
||||
* wcsrchr:: Reverse search for wide character in string
|
||||
@ -63,6 +65,9 @@ declarations are in @file{wchar.h}.
|
||||
@page
|
||||
@include string/wcscpy.def
|
||||
|
||||
@page
|
||||
@include string/wcpcpy.def
|
||||
|
||||
@page
|
||||
@include string/wcscspn.def
|
||||
|
||||
@ -84,6 +89,9 @@ declarations are in @file{wchar.h}.
|
||||
@page
|
||||
@include string/wcsncpy.def
|
||||
|
||||
@page
|
||||
@include string/wcpncpy.def
|
||||
|
||||
@page
|
||||
@include string/wcsnlen.def
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user