aboutsummaryrefslogtreecommitdiff
path: root/man/man3/strcat.html
blob: 542ebd25fc4ee244412c49737e924c2aa2c959cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<head>
<title>strcat(3) - Plan 9 from User Space</title>
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
</head>
<body bgcolor=#ffffff>
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr height=10><td>
<tr><td width=20><td>
<tr><td width=20><td><b>STRCAT(3)</b><td align=right><b>STRCAT(3)</b>
<tr><td width=20><td colspan=2>
    <br>
<p><font size=+1><b>NAME     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    strcat, strncat, strcmp, strncmp, cistrcmp, cistrncmp, strcpy,
    strncpy, strecpy, strlen, strchr, strrchr, strpbrk, strspn, strcspn,
    strtok, strdup, strstr, cistrstr &ndash; string operations<br>
    
</table>
<p><font size=+1><b>SYNOPSIS     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    <tt><font size=+1>#include &lt;u.h&gt;<br>
    #include &lt;libc.h&gt; 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>char* strcat(char *s1, char *s2) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>char* strncat(char *s1, char *s2, long n) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>int &nbsp;&nbsp;&nbsp;&nbsp;strcmp(char *s1, char *s2) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>int &nbsp;&nbsp;&nbsp;&nbsp;strncmp(char *s1, char *s2, long n) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>int &nbsp;&nbsp;&nbsp;&nbsp;cistrcmp(char *s1, char *s2) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>int &nbsp;&nbsp;&nbsp;&nbsp;cistrncmp(char *s1, char *s2, long n) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>char* strcpy(char *s1, char *s2) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>char* strecpy(char *s1, char *es1, char *s2) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>char* strncpy(char *s1, char *s2, long n) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>long &nbsp;&nbsp;&nbsp;strlen(char *s) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>char* strchr(char *s, char c) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>char* strrchr(char *s, char c) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>char* strpbrk(char *s1, char *s2) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>long &nbsp;&nbsp;&nbsp;strspn(char *s1, char *s2) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>long &nbsp;&nbsp;&nbsp;strcspn(char *s1, char *s2) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>char* strtok(char *s1, char *s2) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>char* strdup(char *s) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>char* strstr(char *s1, char *s2) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>char* cistrstr(char *s1, char *s2)<br>
    </font></tt>
</table>
<p><font size=+1><b>DESCRIPTION     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    The arguments <i>s1, s2</i> and <i>s</i> point to null-terminated strings. The
    functions <i>strcat</i>, <i>strncat</i>, <i>strcpy</i>, <i>strecpy</i>, and <i>strncpy</i> all alter
    <i>s1</i>. <i>Strcat</i> and <i>strcpy</i> do not check for overflow of the array pointed
    to by <i>s1</i>. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Strcat</i> appends a copy of string <i>s2</i> to the end of string <i>s1</i>. <i>Strncat</i>
    appends at most <i>n</i> bytes. Each returns a pointer to the null-terminated
    result. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Strcmp</i> compares its arguments and returns an integer less than,
    equal to, or greater than 0, according as <i>s1</i> is lexicographically
    less than, equal to, or greater than <i>s2</i>. <i>Strncmp</i> makes the same
    comparison but examines at most <i>n</i> bytes. <i>Cistrcmp</i> and <i>cistrncmp</i>
    ignore ASCII case distinctions when comparing strings.
    The comparisons are made with unsigned bytes. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Strcpy</i> copies string <i>s2</i> to <i>s1</i>, stopping after the null byte has
    been copied. <i>Strncpy</i> copies exactly <i>n</i> bytes, truncating <i>s2</i> or
    adding null bytes to <i>s1</i> if necessary. The result will not be null-terminated
    if the length of <i>s2</i> is <i>n</i> or more. Each function returns <i>s1</i>. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Strecpy</i> copies bytes until a null byte has been copied, but writes
    no bytes beyond <i>es1</i>. If any bytes are copied, <i>s1</i> is terminated
    by a null byte, and a pointer to that byte is returned. Otherwise,
    the original <i>s1</i> is returned. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Strlen</i> returns the number of bytes in <i>s</i>, not including the terminating
    null byte. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Strchr</i> (<i>strrchr</i>) returns a pointer to the first (last) occurrence
    of byte <i>c</i> in string <i>s</i>, or <tt><font size=+1>0</font></tt> if <i>c</i> does not occur in the string.
    The null byte terminating a string is considered to be part of
    the string. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Strpbrk</i> returns a pointer to the first occurrence in string <i>s1</i>
    of any byte from string <i>s2</i>, <tt><font size=+1>0</font></tt> if no byte from <i>s2</i> exists in <i>s1</i>.
    
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Strspn</i> (<i>strcspn</i>) returns the length of the initial segment of
    string <i>s1</i> which consists entirely of bytes from (not from) string
    <i>s2</i>. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Strtok</i> considers the string <i>s1</i> to consist of a sequence of zero
    or more text tokens separated by spans of one or more bytes from
    the separator string <i>s2</i>. The first call, with pointer <i>s1</i> specified,
    returns a pointer to the first byte of the first token, and will
    have written a null byte into <i>s1</i> immediately following the returned
    token. The function keeps track of its position in the string
    between separate calls; subsequent calls, signified by <i>s1</i> being
    <tt><font size=+1>0</font></tt>, will work through the string <i>s1</i> immediately following that
    token. The separator string <i>s2</i> may be different from call to call.
    When no token remains in <i>s1</i>, <tt><font size=+1>0</font></tt> is returned. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Strdup</i> returns a pointer to a distinct copy of the null-terminated
    string <i>s</i> in space obtained from <a href="../man3/malloc.html"><i>malloc</i>(3)</a> or <tt><font size=+1>0</font></tt> if no space can
    be obtained. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Strstr</i> returns a pointer to the first occurrence of <i>s2</i> as a substring
    of <i>s1</i>, or 0 if there is none. If <i>s2</i> is the null string, <i>strstr</i>
    returns <i>s1</i>. <i>Cistrstr</i> operates analogously, but ignores ASCII case
    differences when comparing strings.<br>
    
</table>
<p><font size=+1><b>SOURCE     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    <tt><font size=+1>/usr/local/plan9/src/lib9<br>
    </font></tt>
</table>
<p><font size=+1><b>SEE ALSO    </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    <a href="../man3/memory.html"><i>memory</i>(3)</a>, <a href="../man3/rune.html"><i>rune</i>(3)</a>, <a href="../man3/runestrcat.html"><i>runestrcat</i>(3)</a><br>
    
</table>
<p><font size=+1><b>BUGS     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    These routines know nothing about UTF. Use the routines in <a href="../man3/rune.html"><i>rune</i>(3)</a>
    as appropriate. Note, however, that the definition of UTF guarantees
    that <i>strcmp</i> compares UTF strings correctly. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    The outcome of overlapping moves varies among implementations.<br>
    
</table>

<td width=20>
<tr height=20><td>
</table>
<!-- TRAILER -->
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr height=15><td width=10><td><td width=10>
<tr><td><td>
<center>
<a href="../../"><img src="../../dist/spaceglenda100.png" alt="Space Glenda" border=1></a>
</center>
</table>
<!-- TRAILER -->
</body></html>