| <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 – 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 <u.h><br> |
| #include <libc.h> |
| <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 strcmp(char *s1, char *s2) |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| </font></tt> |
| <tt><font size=+1>int 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 cistrcmp(char *s1, char *s2) |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| </font></tt> |
| <tt><font size=+1>int 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 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 strspn(char *s1, char *s2) |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| </font></tt> |
| <tt><font size=+1>long 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> |