Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
6557 | serge | 1 | /* |
2 | FUNCTION |
||
3 | < |
||
4 | |||
5 | ANSI_SYNOPSIS |
||
6 | #include |
||
7 | wchar_t *wcsncpy(wchar_t *__restrict <[s1]>, |
||
8 | const wchar_t *__restrict <[s2]>, size_t <[n]>); |
||
9 | |||
10 | TRAD_SYNOPSIS |
||
11 | wchar_t *wcsncpy(<[s1]>, <[s2]>, <[n]> |
||
12 | wchar_t *__restrict <[s1]>; |
||
13 | const wchar_t *__restrict <[s2]>; |
||
14 | size_t <[n]>; |
||
15 | |||
16 | DESCRIPTION |
||
17 | The < |
||
18 | (wide-character codes that follow a null wide-character code are not |
||
19 | copied) from the array pointed to by <[s2]> to the array pointed to |
||
20 | by <[s1]>. If copying takes place between objects that overlap, the |
||
21 | behaviour is undefined. Note that if <[s1]> contains more than <[n]> |
||
22 | wide characters before its terminating null, the result is not |
||
23 | null-terminated. |
||
24 | |||
25 | If the array pointed to by <[s2]> is a wide-character string that is |
||
26 | shorter than <[n]> wide-character codes, null wide-character codes are |
||
27 | appended to the copy in the array pointed to by <[s1]>, until <[n]> |
||
28 | wide-character codes in all are written. |
||
29 | |||
30 | RETURNS |
||
31 | The < |
||
32 | indicate an error. |
||
33 | |||
34 | PORTABILITY |
||
35 | ISO/IEC 9899; POSIX.1. |
||
36 | |||
37 | No supporting OS subroutines are required. |
||
38 | */ |
||
39 | |||
40 | #include <_ansi.h> |
||
41 | #include |
||
42 | |||
43 | wchar_t * |
||
44 | _DEFUN (wcsncpy, (s1, s2, n), |
||
45 | wchar_t *__restrict s1 _AND |
||
46 | _CONST wchar_t *__restrict s2 _AND |
||
47 | size_t n) |
||
48 | { |
||
49 | wchar_t *dscan=s1; |
||
50 | |||
51 | while(n > 0) |
||
52 | { |
||
53 | --n; |
||
54 | if((*dscan++ = *s2++) == L'\0') break; |
||
55 | } |
||
56 | while(n-- > 0) *dscan++ = L'\0'; |
||
57 | |||
58 | return s1; |
||
59 | }[s1]> |