OSDN Git Service

(split) Apply minor changes from v3.32 to v3.35 in the upstream.
[linuxjm/LDP_man-pages.git] / release / man3 / strcat.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" References consulted:
24 .\"     Linux libc source code
25 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
26 .\"     386BSD man pages
27 .\" Modified Sat Jul 24 18:11:47 1993 by Rik Faith (faith@cs.unc.edu)
28 .\" 2007-06-15, Marc Boyer <marc.boyer@enseeiht.fr> + mtk
29 .\"     Improve discussion of strncat().
30 .\"
31 .\" Japanese Version Copyright (c) 1997 YOSHINO Takashi
32 .\"       all rights reserved.
33 .\" Translated Mon Jan 20 22:47:14 JST 1997
34 .\"       by YOSHINO Takashi <yoshino@civil.jcn.nihon-u.ac.jp>
35 .\" Updated & Modified Fri Feb 18 00:30:00 JST 2005
36 .\"       by Yuichi SATO <ysato444@yahoo.co.jp>
37 .\" Updated 2007-07-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.58
38 .\"
39 .TH STRCAT 3  2011-09-28 "GNU" "Linux Programmer's Manual"
40 .SH Ì¾Á°
41 strcat, strncat \- Æó¤Ä¤Îʸ»úÎó¤òÏ¢·ë¤¹¤ë
42 .SH ½ñ¼°
43 .nf
44 .B #include <string.h>
45 .sp
46 .BI "char *strcat(char *" dest ", const char *" src );
47 .sp
48 .BI "char *strncat(char *" dest ", const char *" src ", size_t " n );
49 .fi
50 .SH ÀâÌÀ
51 .BR strcat ()
52 ´Ø¿ô¤Ï¡¢\fIdest\fP Ê¸»úÎó¤Î¸å¤Ë \fIsrc\fP Ê¸»úÎó¤òÉÕ¤±²Ã¤¨¤ë¡£
53 ¤½¤ÎºÝ¤Ë¡¢\fIdest\fP ¤ÎºÇ¸å¤Ë¤¢¤ë½ªÃ¼¤Î NULL ¥Ð¥¤¥È (\(aq\\0\(aq)
54 ¤Ï¾å½ñ¤­¤µ¤ì¡¢¿·¤¿¤ËÀ¸À®¤µ¤ì¤¿Ê¸»úÎó¤ÎËöÈø¤Ë½ªÃ¼¤Î NULL ¥Ð¥¤¥È¤¬ÉÕÍ¿¤µ¤ì¤ë¡£
55 Æó¤Ä¤Îʸ»úÎó \fIsrc\fP ¤È \fIdest\fP ¤Ï½Å¤Ê¤Ã¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
56 ¤Þ¤¿¡¢Ê¸»úÎó \fIdest\fP ¤Ï¡¢Ï¢·ë¸å¤Î·ë²Ì¤ò³ÊǼ¤¹¤ë¤Î¤Ë
57 ½½Ê¬¤ÊÂ礭¤µ¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
58 .PP
59 .BR strncat ()
60 ¤âƱÍͤÀ¤¬¡¢°Ê²¼¤ÎÅÀ¤¬°Û¤Ê¤ë¡£
61 .IP * 3
62 \fIsrc\fP ¤Î¤¦¤ÁºÇÂç \fIn\fP Ê¸»ú¤¬»ÈÍѤµ¤ì¤ë¡£
63 .IP *
64 \fIsrc\fP ¤¬ \fIn\fP Ê¸»ú°Ê¾å¤Î¾ì¹ç¡¢
65 \fIsrc\fP ¤Ï NULL ½ªÃ¼¤µ¤ì¤Æ¤¤¤ëɬÍפϤʤ¤¡£
66 .PP
67 .BR strcat ()
68 ¤ÈƱ¤¸¤¯¡¢\fIdest\fP ¤Ë³ÊǼ¤µ¤ì¤ë·ë²Ì¤Îʸ»úÎó¤Ï¾ï¤Ë NULL ½ªÃ¼¤µ¤ì¤ë¡£
69 .PP
70 \fIsrc\fP ¤¬ \fIn\fP Ê¸»ú°Ê¾å¤Î¾ì¹ç¡¢
71 .BR strncat ()
72 ¤Ï \fIdest\fP ¤Ë \fIn+1\fP Ê¸»ú¤ò½ñ¤­¹þ¤à
73 (\fIsrc\fP ¤«¤é¤Î \fIn\fP Ê¸»ú¤È½ªÃ¼¤Î NULL ¥Ð¥¤¥È¤Ç¤¢¤ë)¡£
74 ¤·¤¿¤¬¤Ã¤Æ¡¢\fIdest\fP ¤ÎÂ礭¤µ¤ÏºÇÄã¤Ç¤â
75 \fIstrlen(dest)+n+1\fP ¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
76
77 .BR strncat ()
78 ¤Î´Êñ¤Ê¼ÂÁõ¤Ï°Ê²¼¤Î¤è¤¦¤Ê´¶¤¸¤Ç¤¢¤í¤¦:
79 .in +4n
80 .nf
81
82 char*
83 strncat(char *dest, const char *src, size_t n)
84 {
85     size_t dest_len = strlen(dest);
86     size_t i;
87
88     for (i = 0 ; i < n && src[i] != \(aq\\0\(aq ; i++)
89         dest[dest_len + i] = src[i];
90     dest[dest_len + i] = \(aq\\0\(aq;
91
92     return dest;
93 }
94 .fi
95 .in
96 .SH ÊÖ¤êÃÍ
97 .BR strcat ()
98 ´Ø¿ô¤È
99 .BR strncat ()
100 ´Ø¿ô¤Ï¡¢·ë²Ì¤È¤·¤Æ¤Ç¤­¤ëʸ»úÎó
101 \fIdest\fP ¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£
102 .SH ½àµò
103 SVr4, 4.3BSD, C89, C99.
104 .SH ´ØÏ¢¹àÌÜ
105 .BR bcopy (3),
106 .BR memccpy (3),
107 .BR memcpy (3),
108 .BR strcpy (3),
109 .BR string (3),
110 .BR strncpy (3),
111 .BR wcscat (3),
112 .BR wcsncat (3)