| 1 | .TH STRING 3 |
| 2 | .SH NAME |
| 3 | strcat, strcatn, strcmp, strcmpn, strcpy, strcpyn, strlen, index, rindex \- string operations |
| 4 | .SH SYNOPSIS |
| 5 | .B char *strcat(s1, s2) |
| 6 | .br |
| 7 | .B char *s1, *s2; |
| 8 | .PP |
| 9 | .B char *strcatn(s1, s2, n) |
| 10 | .br |
| 11 | .B char *s1, *s2; |
| 12 | .PP |
| 13 | .B strcmp(s1, s2) |
| 14 | .br |
| 15 | .B char *s1, *s2; |
| 16 | .PP |
| 17 | .B strcmpn(s1, s2, n) |
| 18 | .br |
| 19 | .B char *s1, *s2; |
| 20 | .PP |
| 21 | .B char *strcpy(s1, s2) |
| 22 | .br |
| 23 | .B char *s1, *s2; |
| 24 | .PP |
| 25 | .B char *strcpyn(s1, s2, n) |
| 26 | .br |
| 27 | .B char *s1, *s2; |
| 28 | .PP |
| 29 | .B strlen(s) |
| 30 | .br |
| 31 | .B char *s; |
| 32 | .PP |
| 33 | .B char *index(s, c) |
| 34 | .br |
| 35 | .B char *s, c; |
| 36 | .PP |
| 37 | .B char *rindex(s, c) |
| 38 | .br |
| 39 | .B char *s; |
| 40 | .SH DESCRIPTION |
| 41 | These functions operate on null-terminated strings. |
| 42 | They do not check for overflow of any receiving string. |
| 43 | .PP |
| 44 | .I Strcat |
| 45 | appends a copy of string |
| 46 | .I s2 |
| 47 | to the end of string |
| 48 | .IR s1 . |
| 49 | .I Strcatn |
| 50 | copies at most |
| 51 | .I n |
| 52 | characters. |
| 53 | Both return a pointer to the null-terminated result. |
| 54 | .PP |
| 55 | .I Strcmp |
| 56 | compares its arguments and returns an integer |
| 57 | greater than, equal to, or less than 0, |
| 58 | according as |
| 59 | .I s1 |
| 60 | is lexicographically greater than, equal to, or |
| 61 | less than |
| 62 | .IR s2 . |
| 63 | .I Strcmpn |
| 64 | makes the same comparison but looks at at most |
| 65 | .I n |
| 66 | characters. |
| 67 | .PP |
| 68 | .I Strcpy |
| 69 | copies string |
| 70 | .I s2 |
| 71 | to |
| 72 | .I s1, |
| 73 | stopping after the null character has been moved. |
| 74 | .I Strcpyn |
| 75 | copies exactly |
| 76 | .I n |
| 77 | characters, |
| 78 | truncating or null-padding |
| 79 | .I s2; |
| 80 | the target may not be null-terminated if the length |
| 81 | of |
| 82 | .I s2 |
| 83 | is |
| 84 | .I n |
| 85 | or more. |
| 86 | Both return |
| 87 | .IR s1 . |
| 88 | .PP |
| 89 | .I Strlen |
| 90 | returns the number of non-null characters in |
| 91 | .IR s . |
| 92 | .PP |
| 93 | .I Index |
| 94 | .RI ( rindex ) |
| 95 | returns a pointer to the first (last) |
| 96 | occurrence of character |
| 97 | .I c |
| 98 | in string |
| 99 | .I s, |
| 100 | or zero if |
| 101 | .I c |
| 102 | does not occur in the string. |
| 103 | .SH BUGS |
| 104 | .I Strcmp |
| 105 | uses native character comparison, which is signed |
| 106 | on PDP11's and VAX-11's, unsigned on other machines. |