| [3ae31e9] | 1 | LIBSM.DOC Last updated 1987-04-29
|
|---|
| 2 |
|
|---|
| 3 | Memory Functions
|
|---|
| 4 | ----------------
|
|---|
| 5 |
|
|---|
| 6 | memccpy.c
|
|---|
| 7 | ---------
|
|---|
| 8 |
|
|---|
| 9 | char *
|
|---|
| 10 | memccpy(s1, s2, c, n)
|
|---|
| 11 | char *s1, *s2;
|
|---|
| 12 | int c, n;
|
|---|
| 13 |
|
|---|
| 14 | Copy s2 to s1, stopping if character c is copied.
|
|---|
| 15 | Copy no more than n bytes.
|
|---|
| 16 |
|
|---|
| 17 | Return a pointer to the byte after character c in the copy,
|
|---|
| 18 | or NULL if c is not found in the first n bytes.
|
|---|
| 19 |
|
|---|
| 20 | memchr.c
|
|---|
| 21 | --------
|
|---|
| 22 |
|
|---|
| 23 | char *
|
|---|
| 24 | memchr(sp, c, n)
|
|---|
| 25 | char *sp, c;
|
|---|
| 26 | int n;
|
|---|
| 27 |
|
|---|
| 28 | Return the ptr in sp at which the character c appears;
|
|---|
| 29 | NULL if not found in n chars; don't stop at \0.
|
|---|
| 30 |
|
|---|
| 31 | memcmp.c
|
|---|
| 32 | --------
|
|---|
| 33 |
|
|---|
| 34 | int
|
|---|
| 35 | memcmp(s1, s2, n)
|
|---|
| 36 | char *s1, *s2;
|
|---|
| 37 | int n;
|
|---|
| 38 |
|
|---|
| 39 | Compare n bytes: s1>s2: >0 s1==s2: 0 s1<s2: <0
|
|---|
| 40 |
|
|---|
| 41 | memcmpu.c
|
|---|
| 42 | ---------
|
|---|
| 43 |
|
|---|
| 44 | int
|
|---|
| 45 | memcmpu(s1, s2, n)
|
|---|
| 46 | char *s1, *s2;
|
|---|
| 47 | int n;
|
|---|
| 48 |
|
|---|
| 49 | Compare n bytes, ignoring case:
|
|---|
| 50 | s1>s2: >0 s1==s2: 0 s1<s2: <0
|
|---|
| 51 | |
|---|
| 52 |
|
|---|
| 53 | memcpy.c
|
|---|
| 54 | --------
|
|---|
| 55 |
|
|---|
| 56 | char *
|
|---|
| 57 | memcpy(s1, s2, n)
|
|---|
| 58 | char *s1, *s2;
|
|---|
| 59 | int n;
|
|---|
| 60 |
|
|---|
| 61 | Copy s2 to s1, always copy n bytes.
|
|---|
| 62 |
|
|---|
| 63 | Return s1
|
|---|
| 64 |
|
|---|
| 65 | memcpyw.c
|
|---|
| 66 | ---------
|
|---|
| 67 |
|
|---|
| 68 | int *
|
|---|
| 69 | memcpyw(s1, s2, n)
|
|---|
| 70 | int *s1, *s2, n;
|
|---|
| 71 |
|
|---|
| 72 | Copy s2 to s1, always copy n words.
|
|---|
| 73 | Return pointer to s1.
|
|---|
| 74 |
|
|---|
| 75 | memset.c
|
|---|
| 76 | --------
|
|---|
| 77 |
|
|---|
| 78 | char *
|
|---|
| 79 | memset(sp, c, n)
|
|---|
| 80 | char *sp, c;
|
|---|
| 81 | int n;
|
|---|
| 82 |
|
|---|
| 83 | Set an array of n chars starting at sp to the character c.
|
|---|
| 84 |
|
|---|
| 85 | Return sp.
|
|---|
| 86 |
|
|---|
| 87 | memsetw.c
|
|---|
| 88 | ---------
|
|---|
| 89 |
|
|---|
| 90 | int *
|
|---|
| 91 | memsetw(sp, w, n)
|
|---|
| 92 | int *sp, w, n;
|
|---|
| 93 |
|
|---|
| 94 | Set an array of n ints starting at sp to the int w.
|
|---|
| 95 | Return pointer to sp.
|
|---|
| 96 | |
|---|
| 97 |
|
|---|
| 98 | String Functions
|
|---|
| 99 | ----------------
|
|---|
| 100 |
|
|---|
| 101 | index.c
|
|---|
| 102 | -------
|
|---|
| 103 | Returns a pointer to the first occurrence of character c in
|
|---|
| 104 | string s, or 0 if c does not occur in the string.
|
|---|
| 105 |
|
|---|
| 106 | char *
|
|---|
| 107 | index(s, c)
|
|---|
| 108 | char *s, c;
|
|---|
| 109 |
|
|---|
| 110 | rindex.c
|
|---|
| 111 | --------
|
|---|
| 112 | Returns a pointer to the last occurrence of character c in
|
|---|
| 113 | string s, or 0 if c does not occur in the string.
|
|---|
| 114 |
|
|---|
| 115 | char *
|
|---|
| 116 | rindex(s, c)
|
|---|
| 117 | char *s, c;
|
|---|
| 118 |
|
|---|
| 119 | str2lc.c
|
|---|
| 120 | --------
|
|---|
| 121 | Converts all of the upper case ASCII characters in string s
|
|---|
| 122 | to lower case ASCII characters. Returns s.
|
|---|
| 123 |
|
|---|
| 124 | char *
|
|---|
| 125 | str2lc(s)
|
|---|
| 126 | char *s;
|
|---|
| 127 |
|
|---|
| 128 | str2uc.c
|
|---|
| 129 | --------
|
|---|
| 130 | Converts all of the lower case ASCII characters in string s
|
|---|
| 131 | to upper case ASCII characters. Returns s.
|
|---|
| 132 |
|
|---|
| 133 | char *
|
|---|
| 134 | str2uc(s)
|
|---|
| 135 | char *s;
|
|---|
| 136 |
|
|---|
| 137 | strcat.c
|
|---|
| 138 | --------
|
|---|
| 139 | Concatenates s2 onto the end of s1. S1's space must be large enough.
|
|---|
| 140 |
|
|---|
| 141 | Returns s1.
|
|---|
| 142 |
|
|---|
| 143 | char *
|
|---|
| 144 | strcat(s1, s2)
|
|---|
| 145 | char *s1, *s2;
|
|---|
| 146 | |
|---|
| 147 |
|
|---|
| 148 | strccpy.c
|
|---|
| 149 | ---------
|
|---|
| 150 | Copies s2 to s1 up to the first occurrence of c. s1's space must be
|
|---|
| 151 | large enough to contain the characters copied from s2. The character
|
|---|
| 152 | c is not copied. Returns s1.
|
|---|
| 153 |
|
|---|
| 154 | char *
|
|---|
| 155 | strccpy(s1, s2, c)
|
|---|
| 156 | char *s1, *s2, c;
|
|---|
| 157 |
|
|---|
| 158 | strchr.c
|
|---|
| 159 | --------
|
|---|
| 160 | Returns a ptr into sp where the character c appears;
|
|---|
| 161 | Returns NULL if c is not found.
|
|---|
| 162 |
|
|---|
| 163 | char *
|
|---|
| 164 | strchr(sp, c)
|
|---|
| 165 | char *sp, c;
|
|---|
| 166 |
|
|---|
| 167 | strcmp.c
|
|---|
| 168 | --------
|
|---|
| 169 | Compares string s1 to s2.
|
|---|
| 170 |
|
|---|
| 171 | Returns:
|
|---|
| 172 | s1>s2: >0
|
|---|
| 173 | s1==s2: 0
|
|---|
| 174 | s1<s2: <0
|
|---|
| 175 |
|
|---|
| 176 | int
|
|---|
| 177 | strcmp(s1, s2)
|
|---|
| 178 | char *s1, *s2;
|
|---|
| 179 |
|
|---|
| 180 | strcpy.c
|
|---|
| 181 | --------
|
|---|
| 182 | Copies string s2 to s1. s1 must be large enough.
|
|---|
| 183 |
|
|---|
| 184 | Returns s1.
|
|---|
| 185 |
|
|---|
| 186 | char *
|
|---|
| 187 | strcpy(s1, s2)
|
|---|
| 188 | char *s1, *s2;
|
|---|
| 189 | strcspn.c
|
|---|
| 190 | ---------
|
|---|
| 191 | Returns the number of characters in the maximum leading segment
|
|---|
| 192 | of string which consists solely of characters NOT from charset.
|
|---|
| 193 |
|
|---|
| 194 | int
|
|---|
| 195 | strcspn(string, charset)
|
|---|
| 196 | char *string;
|
|---|
| 197 | char *charset;
|
|---|
| 198 | |
|---|
| 199 |
|
|---|
| 200 | strlcmp.c
|
|---|
| 201 | ---------
|
|---|
| 202 | Compares a string to each entry in a list. Returns 0 if
|
|---|
| 203 | no match, or the 1-origin index of the string in the list.
|
|---|
| 204 |
|
|---|
| 205 | int
|
|---|
| 206 | strlcmp(s, l)
|
|---|
| 207 | char *s, *l[];
|
|---|
| 208 |
|
|---|
| 209 | strlen.c
|
|---|
| 210 | --------
|
|---|
| 211 | Returns the number of non-NULL bytes in string argument.
|
|---|
| 212 |
|
|---|
| 213 | int
|
|---|
| 214 | strlen(s)
|
|---|
| 215 | char *s;
|
|---|
| 216 |
|
|---|
| 217 | strncat.c
|
|---|
| 218 | ---------
|
|---|
| 219 | Concatenates s2 onto the end of s1. S1's space must be large enough.
|
|---|
| 220 | At most n characters are moved.
|
|---|
| 221 |
|
|---|
| 222 | Returns s1.
|
|---|
| 223 |
|
|---|
| 224 | char *
|
|---|
| 225 | strncat(s1, s2, n)
|
|---|
| 226 | char *s1, *s2;
|
|---|
| 227 | int n;
|
|---|
| 228 | |
|---|
| 229 |
|
|---|
| 230 | strncmp.c
|
|---|
| 231 | ---------
|
|---|
| 232 | Compares string s1 to s2, comparing at most n bytes.
|
|---|
| 233 |
|
|---|
| 234 | Returns:
|
|---|
| 235 | s1>s2; >0
|
|---|
| 236 | s1==s2; 0
|
|---|
| 237 | s1<s2; <0
|
|---|
| 238 |
|
|---|
| 239 | int
|
|---|
| 240 | strncmp(s1, s2, n)
|
|---|
| 241 | char *s1, *s2;
|
|---|
| 242 | int n;
|
|---|
| 243 |
|
|---|
| 244 | strncpy.c
|
|---|
| 245 | ---------
|
|---|
| 246 | Copies s2 to s1, truncating or null-padding to always copy n bytes.
|
|---|
| 247 |
|
|---|
| 248 | Returns s1.
|
|---|
| 249 |
|
|---|
| 250 | char *
|
|---|
| 251 | strncpy(s1, s2, n)
|
|---|
| 252 | char *s1, *s2;
|
|---|
| 253 | int n;
|
|---|
| 254 |
|
|---|
| 255 | strpbrk.c
|
|---|
| 256 | ---------
|
|---|
| 257 | Returns a ptr to the first occurance of any character from `brkset'
|
|---|
| 258 | in the character string `string'. Returns NULL if none exists.
|
|---|
| 259 |
|
|---|
| 260 | char *
|
|---|
| 261 | strpbrk(string, brkset)
|
|---|
| 262 | char *string, *brkset;
|
|---|
| 263 |
|
|---|
| 264 | strrchr.c
|
|---|
| 265 | ---------
|
|---|
| 266 | Return the ptr in sp at which the character c last appears.
|
|---|
| 267 | Returns NULL if not found.
|
|---|
| 268 |
|
|---|
| 269 | char *
|
|---|
| 270 | strrchr(sp, c)
|
|---|
| 271 | char *sp, c;
|
|---|
| 272 | |
|---|
| 273 |
|
|---|
| 274 | strspn.c
|
|---|
| 275 | --------
|
|---|
| 276 | Return the number of characters in the maximum leading segment
|
|---|
| 277 | of string which consists solely of characters from charset.
|
|---|
| 278 |
|
|---|
| 279 | int
|
|---|
| 280 | strspn(string, charset)
|
|---|
| 281 | char *string;
|
|---|
| 282 | char *charset;
|
|---|
| 283 |
|
|---|
| 284 | strtok.c
|
|---|
| 285 | --------
|
|---|
| 286 | Uses strpbrk and strspn to break string into tokens on
|
|---|
| 287 | sequentially subsequent calls.
|
|---|
| 288 |
|
|---|
| 289 | Returns NULL when no non-separator characters remain.
|
|---|
| 290 |
|
|---|
| 291 | 'Subsequent' calls are calls in which the first argument is NULL.
|
|---|
| 292 |
|
|---|
| 293 | char *
|
|---|
| 294 | strtok(string, sepset)
|
|---|
| 295 | char *string, *sepset;
|
|---|
| 296 |
|
|---|
| 297 | strtol.c
|
|---|
| 298 | --------
|
|---|
| 299 | Converts string str as a long integer in the base determined
|
|---|
| 300 | by base, if base is non-zero. Otherwise, the string determines
|
|---|
| 301 | the base (decimal, octal, or hex).
|
|---|
| 302 |
|
|---|
| 303 | If ptr in non-null, the location at ptr will be set to point
|
|---|
| 304 | at the character that stopped the scan.
|
|---|
| 305 |
|
|---|
| 306 | long
|
|---|
| 307 | strtol(str, ptr, base)
|
|---|
| 308 | char *str;
|
|---|
| 309 | char **ptr;
|
|---|
| 310 | int base;
|
|---|
| 311 |
|
|---|