Author: das
Date: Wed Mar  4 06:01:27 2009
New Revision: 189361
URL: http://svn.freebsd.org/changeset/base/189361

Log:
  Add wcpcpy(3) and wcpncpy(3).

Added:
  head/lib/libc/string/wcpcpy.c   (contents, props changed)
     - copied, changed from r189360, head/lib/libc/string/stpcpy.c
  head/lib/libc/string/wcpncpy.c   (contents, props changed)
     - copied, changed from r189360, head/lib/libc/string/stpncpy.c
Modified:
  head/include/wchar.h
  head/lib/libc/string/Makefile.inc
  head/lib/libc/string/Symbol.map
  head/lib/libc/string/wmemchr.3

Modified: head/include/wchar.h
==============================================================================
--- head/include/wchar.h        Wed Mar  4 03:47:57 2009        (r189360)
+++ head/include/wchar.h        Wed Mar  4 06:01:27 2009        (r189361)
@@ -213,6 +213,8 @@ int wcwidth(wchar_t);
 #if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE
 size_t mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
            size_t, mbstate_t * __restrict);
+wchar_t        *wcpcpy(wchar_t __restrict *, const wchar_t * __restrict);
+wchar_t        *wcpncpy(wchar_t __restrict *, const wchar_t * __restrict, 
size_t);
 wchar_t        *wcsdup(const wchar_t *) __malloc_like;
 int    wcscasecmp(const wchar_t *, const wchar_t *);
 int    wcsncasecmp(const wchar_t *, const wchar_t *, size_t n);

Modified: head/lib/libc/string/Makefile.inc
==============================================================================
--- head/lib/libc/string/Makefile.inc   Wed Mar  4 03:47:57 2009        
(r189360)
+++ head/lib/libc/string/Makefile.inc   Wed Mar  4 06:01:27 2009        
(r189361)
@@ -14,7 +14,7 @@ MISRCS+=bcmp.c bcopy.c bzero.c ffs.c ffs
        strdup.c strerror.c strlcat.c strlcpy.c strlen.c strmode.c strncat.c \
        strncmp.c strncpy.c strndup.c strnlen.c strnstr.c \
        strpbrk.c strrchr.c strsep.c strsignal.c strspn.c strstr.c strtok.c \
-       strxfrm.c swab.c wcscasecmp.c wcscat.c \
+       strxfrm.c swab.c wcpcpy.c wcpncpy.c wcscasecmp.c wcscat.c \
        wcschr.c wcscmp.c wcscoll.c wcscpy.c wcscspn.c wcsdup.c \
        wcslcat.c wcslcpy.c wcslen.c wcsncasecmp.c wcsncat.c wcsncmp.c \
        wcsncpy.c wcsnlen.c wcspbrk.c \
@@ -61,7 +61,9 @@ MLINKS+=strlen.3 strnlen.3
 MLINKS+=strstr.3 strcasestr.3 \
        strstr.3 strnstr.3
 MLINKS+=strtok.3 strtok_r.3
-MLINKS+=wmemchr.3 wcscasecmp.3 \
+MLINKS+=wmemchr.3 wcpcpy.3 \
+       wmemchr.3 wcpncpy.3 \
+       wmemchr.3 wcscasecmp.3 \
        wmemchr.3 wcscat.3 \
        wmemchr.3 wcschr.3 \
        wmemchr.3 wcscmp.3 \

Modified: head/lib/libc/string/Symbol.map
==============================================================================
--- head/lib/libc/string/Symbol.map     Wed Mar  4 03:47:57 2009        
(r189360)
+++ head/lib/libc/string/Symbol.map     Wed Mar  4 06:01:27 2009        
(r189361)
@@ -84,6 +84,8 @@ FBSD_1.1 {
        stpncpy;
        strndup;
        strnlen;
+       wcpcpy;
+       wcpncpy;
        wcscasecmp;
        wcsncasecmp;
        wcsnlen;

Copied and modified: head/lib/libc/string/wcpcpy.c (from r189360, 
head/lib/libc/string/stpcpy.c)
==============================================================================
--- head/lib/libc/string/stpcpy.c       Wed Mar  4 03:47:57 2009        
(r189360, copy source)
+++ head/lib/libc/string/wcpcpy.c       Wed Mar  4 06:01:27 2009        
(r189361)
@@ -35,10 +35,10 @@ static char sccsid[] = "@(#)strcpy.c        8.1
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#include <string.h>
+#include <wchar.h>
 
-char *
-stpcpy(char * __restrict to, const char * __restrict from)
+wchar_t *
+wcpcpy(wchar_t * __restrict to, const wchar_t * __restrict from)
 {
 
        for (; (*to = *from); ++from, ++to);

Copied and modified: head/lib/libc/string/wcpncpy.c (from r189360, 
head/lib/libc/string/stpncpy.c)
==============================================================================
--- head/lib/libc/string/stpncpy.c      Wed Mar  4 03:47:57 2009        
(r189360, copy source)
+++ head/lib/libc/string/wcpncpy.c      Wed Mar  4 06:01:27 2009        
(r189361)
@@ -27,17 +27,17 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#include <string.h>
+#include <wchar.h>
 
-char *
-stpncpy(char * __restrict dst, const char * __restrict src, size_t n)
+wchar_t *
+wcpncpy(wchar_t * __restrict dst, const wchar_t * __restrict src, size_t n)
 {
 
        for (; n--; dst++, src++) {
                if (!(*dst = *src)) {
-                       char *ret = dst;
+                       wchar_t *ret = dst;
                        while (n--)
-                               *++dst = '\0';
+                               *++dst = L'\0';
                        return (ret);
                }
        }

Modified: head/lib/libc/string/wmemchr.3
==============================================================================
--- head/lib/libc/string/wmemchr.3      Wed Mar  4 03:47:57 2009        
(r189360)
+++ head/lib/libc/string/wmemchr.3      Wed Mar  4 06:01:27 2009        
(r189361)
@@ -35,7 +35,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 28, 2009
+.Dd March 4, 2009
 .Dt WMEMCHR 3
 .Os
 .Sh NAME
@@ -44,6 +44,8 @@
 .Nm wmemcpy ,
 .Nm wmemmove ,
 .Nm wmemset ,
+.Nm wcpcpy ,
+.Nm wcpncpy ,
 .Nm wcscasecmp ,
 .Nm wcscat ,
 .Nm wcschr ,
@@ -78,6 +80,10 @@
 .Fn wmemmove "wchar_t *s1" "const wchar_t *s2" "size_t n"
 .Ft wchar_t *
 .Fn wmemset "wchar_t *s" "wchar_t c" "size_t n"
+.Ft wchar_t *
+.Fn wcpcpy "wchar_t *s1" "wchar_t *s2"
+.Ft wchar_t *
+.Fn wcpncpy "wchar_t *s1" "wchar_t *s2" "size_t n"
 .Ft int
 .Fn wcscasecmp "const wchar_t *s1" "const wchar_t *s2"
 .Ft wchar_t *
@@ -128,6 +134,8 @@ counterpart, such as
 .Xr memcpy 3 ,
 .Xr memmove 3 ,
 .Xr memset 3 ,
+.Xr stpcpy 3 ,
+.Xr stpncpy 3 ,
 .Xr strcasecmp 3 ,
 .Xr strcat 3 ,
 .Xr strchr 3 ,
@@ -150,6 +158,8 @@ counterpart, such as
 These functions conform to
 .St -isoC-99 ,
 with the exception of
+.Fn wcpcpy ,
+.Fn wcpncpy ,
 .Fn wcscasecmp ,
 .Fn wcsdup ,
 .Fn wcsncasecmp ,
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to