Annotation of researchv10dc/man/man3/string.3, revision 1.1.1.1

1.1       root        1: .TH STRING 3
                      2: .CT 2 data_man
                      3: .SH NAME
                      4: strcat, strncat, strcmp, strncmp, strcpy, strncpy, strlen,
                      5: strchr, strrchr, strpbrk, strspn, strcspn, strtok, strdup \(mi string operations
                      6: .SH SYNOPSIS
                      7: .nf
                      8: .2C
                      9: .B #include <libc.h>
                     10: .PP
                     11: .B char *strcat(s1, s2)
                     12: .B char *s1, *s2;
                     13: .PP
                     14: .B char *strncat(s1, s2, n)
                     15: .B char *s1, *s2;
                     16: .B int n;
                     17: .PP
                     18: .B int strcmp(s1, s2)
                     19: .B char *s1, *s2;
                     20: .PP
                     21: .B int strncmp(s1, s2, n)
                     22: .B char *s1, *s2;
                     23: .B int n;
                     24: .PP
                     25: .B char *strcpy(s1, s2)
                     26: .B char *s1, *s2;
                     27: .PP
                     28: .B char *strncpy(s1, s2, n)
                     29: .B char *s1, *s2;
                     30: .B int n;
                     31: .PP
                     32: .B int strlen(s)
                     33: .B char *s;
                     34: .PP
                     35: .B char *strchr(s, c)
                     36: .B char *s;
                     37: .B int c;
                     38: .PP
                     39: .B char *strrchr(s, c)
                     40: .B char *s;
                     41: .B int c;
                     42: .PP
                     43: .B char *strpbrk(s1, s2)
                     44: .B char *s1, *s2;
                     45: .PP
                     46: .B int strspn(s1, s2)
                     47: .B char *s1, *s2;
                     48: .PP
                     49: .B int strcspn(s1, s2)
                     50: .B char *s1, *s2;
                     51: .PP
                     52: .B char *strtok(s1, s2)
                     53: .B char *s1, *s2;
                     54: .PP
                     55: .B char *strdup(s)
                     56: .B char *s;
                     57: .sp
                     58: .1C
                     59: .SH DESCRIPTION
                     60: The arguments
                     61: .I s1, s2
                     62: and
                     63: .I s
                     64: point to null-terminated strings.
                     65: The functions
                     66: .IR strcat ,
                     67: .IR strncat ,
                     68: .IR strcpy ,
                     69: and
                     70: .I strncpy
                     71: all alter
                     72: .IR s1 .
                     73: These functions do not check for overflow of
                     74: the array pointed to by
                     75: .IR s1 .
                     76: .PP
                     77: .I Strcat
                     78: appends a copy of string
                     79: .I s2
                     80: to the end of string
                     81: .IR s1 .
                     82: .I Strncat
                     83: appends at most
                     84: .I n
                     85: characters.
                     86: Each returns a pointer to the null-terminated result.
                     87: .PP
                     88: .I Strcmp
                     89: compares its arguments and returns an integer
                     90: less than, equal to, or greater than 0,
                     91: according as
                     92: .I s1
                     93: is lexicographically less than, equal to, or
                     94: greater than
                     95: .IR s2 .
                     96: .I Strncmp
                     97: makes the same comparison but looks at at most
                     98: .I n
                     99: characters.
                    100: .PP
                    101: .I Strcpy
                    102: copies string
                    103: .I s2
                    104: to
                    105: .IR s1 ,
                    106: stopping after the null character has been copied.
                    107: .I Strncpy
                    108: copies exactly
                    109: .I n
                    110: characters,
                    111: truncating
                    112: .I s2
                    113: or adding
                    114: null characters to
                    115: .I s1
                    116: if necessary.
                    117: The result will not be null-terminated if the length
                    118: of
                    119: .I s2
                    120: is
                    121: .I n
                    122: or more.
                    123: Each function returns
                    124: .IR s1 .
                    125: .PP
                    126: .I Strlen
                    127: returns the number of characters in
                    128: .IR s ,
                    129: not including the terminating null character.
                    130: .PP
                    131: .I Strchr
                    132: .RI ( strrchr )
                    133: returns a pointer to the first (last)
                    134: occurrence of character
                    135: .I c
                    136: in string
                    137: .IR s ,
                    138: or
                    139: .L (char *)0
                    140: if
                    141: .I c
                    142: does not occur in the string.
                    143: The null character terminating a string is considered to
                    144: be part of the string.
                    145: .PP
                    146: .I Strpbrk
                    147: returns a pointer to the first occurrence in string
                    148: .I s1
                    149: of any character from string
                    150: .IR s2 ,
                    151: .L (char *)0
                    152: if no character from
                    153: .I s2
                    154: exists in
                    155: .IR s1 .
                    156: .PP
                    157: .I Strspn
                    158: .RI ( strcspn )
                    159: returns the length of the initial segment of string
                    160: .I s1
                    161: which consists entirely of characters from (not from) string
                    162: .IR s2 .
                    163: .PP
                    164: .I Strtok
                    165: considers the string
                    166: .I s1
                    167: to consist of a sequence of zero or more text tokens separated
                    168: by spans of one or more characters from the separator string
                    169: .IR s2 .
                    170: The first call, with pointer
                    171: .I s1
                    172: specified, returns a pointer to the first character of the first
                    173: token, having replaced the character after the token by 0.
                    174: Subsequent calls,
                    175: signified by
                    176: .I s1
                    177: being
                    178: .LR "(char *)0" ,
                    179: will scan from where the preceding call left off.
                    180: The separator string
                    181: .I s2
                    182: may be different from call to call.
                    183: When no token remains in
                    184: .IR s1 ,
                    185: .L (char *)0
                    186: is returned.
                    187: .PP
                    188: .I Strdup
                    189: returns a pointer to a distinct copy of the null-terminated string
                    190: .I s
                    191: in space obtained from
                    192: .IR malloc (3)
                    193: or
                    194: .L (char *)0
                    195: if no space can be obtained.
                    196: .SH SEE ALSO
                    197: .IR memory (3)
                    198: .SH BUGS
                    199: .I Strcmp
                    200: and
                    201: .I strncmp
                    202: use native character comparison, which may
                    203: be signed or unsigned.
                    204: .br
                    205: The outcome of overlapping moves varies among implementations.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.