1 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
3 .\" This is free documentation; you can redistribute it and/or
4 .\" modify it under the terms of the GNU General Public License as
5 .\" published by the Free Software Foundation; either version 2 of
6 .\" the License, or (at your option) any later version.
8 .\" References consulted:
9 .\" GNU glibc-2 source code and manual
11 .\" Corrected, aeb, 990824
13 .\" Japanese Version Copyright (c) 1999 HANATAKA Shinya
14 .\" all rights reserved.
15 .\" Translated Tue Jan 11 00:55:50 JST 2000
16 .\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
18 .TH STPNCPY 3 1999-07-25 "GNU" "Linux Programmer's Manual"
21 .\"O stpncpy \- copy a fixed-size string, returning a pointer to its end
22 stpncpy \- ¸ÇÄêŤÎʸ»úÎó¤ò¥³¥Ô¡¼¤·¤Æ¡¢¤½¤ÎºÇ¸å¤Ø¤Î¥Ý¥¤¥ó¥¿¡¼¤òÊÖ¤¹
26 .B #define _GNU_SOURCE
28 .B #include <string.h>
30 .BI "char *stpncpy(char *" dest ", const char *" src ", size_t " n );
36 .\"O function copies at most \fIn\fP characters from the string
37 .\"O pointed to by \fIsrc\fP, including the terminating \(aq\\0\(aq character,
38 .\"O to the array pointed to by \fIdest\fP.
39 .\"O Exactly \fIn\fP characters are written at
41 .\"O If the length \fIstrlen(src)\fP is smaller than \fIn\fP, the
42 .\"O remaining characters in the array pointed to by \fIdest\fP are filled
43 .\"O with \(aq\\0\(aq characters.
44 .\"O If the length \fIstrlen(src)\fP is greater or equal to
45 .\"O \fIn\fP, the string pointed to by \fIdest\fP will
46 .\"O not be \(aq\\0\(aq terminated.
48 ´Ø¿ô¤Ï \fIsrc\fP ¤¬»Ø¤·¤Æ¤¤¤ëʸ»úÎ󤫤齪ü¤Î \(aq\\0\(aq ʸ»ú¤ò
49 ´Þ¤á¤ÆºÇÂç \fIn\fP ¥Ð¥¤¥È¤ò \fIdest\fP ¤Ë¥³¥Ô¡¼¤¹¤ë¡£Ä¹¤µ
50 \fIstrlen(src)\fP ¤¬ \fIn\fP ¤è¤ê¾®¤µ¤¤¾ì¹ç¤Ë¤Ï \fIdest\fP ¤Î»Ä¤ê¤Î
51 Éôʬ¤Ë¤Ï \(aq\\0\(aq ʸ»ú¤¬Ëä¤á¤é¤ì¤ë¡£Ä¹¤µ \fIstrlen(src)\fP ¤¬ \fIn\fP °Ê¾å
52 ¤Ê¤é¤Ð¡¢\fIdest\fP ¤¬»Ø¤¹Ê¸»úÎó¤Ï \(aq\\0\(aq ¤Ç½ªÃ¼¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
54 .\"O The strings may not overlap.
55 Æó¤Ä¤Îʸ»úÎó¤Ï½Å¤Ê¤Ã¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
57 .\"O The programmer must ensure that there is room for at least \fIn\fP characters
59 ¥×¥í¥°¥é¥Þ¡¼¤Ï \fIdest\fP ¤Ë¾¯¤Ê¤¯¤È¤â \fIn\fP ¥Ð¥¤¥È¤Î¶õ¤¤¬¤¢¤ë¤³¤È¤ò
60 Êݾڤ·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
61 .\"O .SH "RETURN VALUE"
64 .\"O returns a pointer to the terminating null
65 .\"O in \fIdest\fP, or, if \fIdest\fP is not null-terminated,
68 ¤Ï \fIdest\fP ¤Î½ªÃ¼¤Î¥Ê¥ëʸ»ú¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¡¼¤òÊÖ¤¹¤«¡¢
69 \fIdest\fP ¤¬¥Ê¥ëʸ»ú¤Ç½ªÃ¼¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¤Ï \fIdest + n\fP ¤òÊÖ¤¹¡£
70 .\"O .SH "CONFORMING TO"
72 .\"O This function is a GNU extension.
73 ¤³¤Î´Ø¿ô¤Ï GNU ¤Î³ÈÄ¥¤Ç¤¢¤ë¡£
78 .BR feature_test_macros (7)