|
|
1.1 ! root 1: .\" Copyright (c) 1980 Regents of the University of California. ! 2: .\" All rights reserved. The Berkeley software License Agreement ! 3: .\" specifies the terms and conditions for redistribution. ! 4: .\" ! 5: .\" @(#)string.3 6.5 (Berkeley) 10/22/87 ! 6: .\" ! 7: .TH STRING 3 "October 22, 1987" ! 8: .UC 4 ! 9: .SH NAME ! 10: strcat, strncat, strcmp, strncmp, strcasecmp, strncasecmp, strcpy, ! 11: strncpy, strlen, index, rindex \- string operations ! 12: .SH SYNOPSIS ! 13: .nf ! 14: .B #include <strings.h> ! 15: .PP ! 16: .B char *strcat(s, append) ! 17: .B char *s, *append; ! 18: .PP ! 19: .B char *strncat(s, append, count) ! 20: .B char *s, *append; ! 21: .B int count; ! 22: .PP ! 23: .B strcmp(s1, s2) ! 24: .B char *s1, *s2; ! 25: .PP ! 26: .B strncmp(s1, s2, count) ! 27: .B char *s1, *s2; ! 28: .B int count; ! 29: .PP ! 30: .B strcasecmp(s1, s2) ! 31: .B char *s1, *s2; ! 32: .PP ! 33: .B strncasecmp(s1, s2, count) ! 34: .B char *s1, *s2; ! 35: .B int count; ! 36: .PP ! 37: .B char *strcpy(to, from) ! 38: .B char *to, *from; ! 39: .PP ! 40: .B char *strncpy(to, from, count) ! 41: .B char *to, *from; ! 42: .B int count; ! 43: .PP ! 44: .B strlen(s) ! 45: .B char *s; ! 46: .PP ! 47: .B char *index(s, c) ! 48: .B char *s, c; ! 49: .PP ! 50: .B char *rindex(s, c) ! 51: .B char *s, c; ! 52: .fi ! 53: .SH DESCRIPTION ! 54: These functions operate on null-terminated strings. ! 55: They do not check for overflow of any receiving string. ! 56: .PP ! 57: \fIStrcat\fP appends a copy of string \fIappend\fP to the end of string ! 58: \fIs\fP. \fIStrncat\fP copies at most \fIcount\fP characters. Both ! 59: return a pointer to the null-terminated result. ! 60: .PP ! 61: \fIStrcmp\fP compares its arguments and returns an integer greater than, ! 62: equal to, or less than 0, according as \fIs1\fP is lexicographically ! 63: greater than, equal to, or less than \fIs2\fP. \fIStrncmp\fP makes the ! 64: same comparison but looks at at most \fIcount\fP characters. ! 65: \fIStrcasecmp\fP and \fIstrncasecmp\fP are identical in function, but are ! 66: case insensitive. The returned lexicographic difference reflects a ! 67: conversion to lower-case. ! 68: .PP ! 69: \fIStrcpy\fP copies string \fIfrom\fP to \fIto\fP, stopping after the ! 70: null character has been moved. \fIStrncpy\fP copies exactly \fIcount\fP ! 71: characters, appending nulls if \fIfrom\fP is less than \fIcount\fP ! 72: characters in length; the target may not be null-terminated if the ! 73: length of \fIfrom\fP is \fIcount\fP or more. Both return \fIto\fP. ! 74: .PP ! 75: \fIStrlen\fP returns the number of non-null characters in \fIs\fP. ! 76: .PP ! 77: .I Index ! 78: .RI ( rindex ) ! 79: returns a pointer to the first (last) occurrence of character ! 80: \fIc\fP in string \fIs\fP or zero if \fIc\fP does not occur in ! 81: the string. Setting \fIc\fP to NULL works.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.