STRING(3) UNIX Programmer's Manual STRING(3) NAME strcat, strncat, strcmp, strncmp, strcasecmp, strncasecmp, strcpy, strncpy, strlen, index, rindex - string operations SYNOPSIS #include char *strcat(s, append) char *s, *append; char *strncat(s, append, count) char *s, *append; int count; strcmp(s1, s2) char *s1, *s2; strncmp(s1, s2, count) char *s1, *s2; int count; strcasecmp(s1, s2) char *s1, *s2; strncasecmp(s1, s2, count) char *s1, *s2; int count; char *strcpy(to, from) char *to, *from; char *strncpy(to, from, count) char *to, *from; int count; strlen(s) char *s; char *index(s, c) char *s, c; char *rindex(s, c) char *s, c; DESCRIPTION These functions operate on null-terminated strings. They do not check for overflow of any receiving string. _S_t_r_c_a_t appends a copy of string _a_p_p_e_n_d to the end of string _s. _S_t_r_n_c_a_t copies at most _c_o_u_n_t characters. Both return a pointer to the null-terminated result. Printed 11/26/99 October 22, 1987 1 STRING(3) UNIX Programmer's Manual STRING(3) _S_t_r_c_m_p compares its arguments and returns an integer greater than, equal to, or less than 0, according as _s_1 is lexico- graphically greater than, equal to, or less than _s_2. _S_t_r_n_c_m_p makes the same comparison but looks at at most _c_o_u_n_t characters. _S_t_r_c_a_s_e_c_m_p and _s_t_r_n_c_a_s_e_c_m_p are identical in function, but are case insensitive. The returned lexico- graphic difference reflects a conversion to lower-case. _S_t_r_c_p_y copies string _f_r_o_m to _t_o, stopping after the null character has been moved. _S_t_r_n_c_p_y copies exactly _c_o_u_n_t characters, appending nulls if _f_r_o_m is less than _c_o_u_n_t char- acters in length; the target may not be null-terminated if the length of _f_r_o_m is _c_o_u_n_t or more. Both return _t_o. _S_t_r_l_e_n returns the number of non-null characters in _s. _I_n_d_e_x (_r_i_n_d_e_x) returns a pointer to the first (last) occurrence of character _c in string _s or zero if _c does not occur in the string. Setting _c to NULL works. Printed 11/26/99 October 22, 1987 2