truncating string copy */
| 284 | |
| 285 | /* truncating string copy */ |
| 286 | void |
| 287 | copynchars(char *dst, const char *src, int n) |
| 288 | { |
| 289 | /* copies at most n characters, stopping sooner if terminator reached; |
| 290 | treats newline as input terminator; unlike strncpy, always supplies |
| 291 | '\0' terminator so dst must be able to hold at least n+1 characters */ |
| 292 | while (n > 0 && *src != '\0' && *src != '\n') { |
| 293 | *dst++ = *src++; |
| 294 | --n; |
| 295 | } |
| 296 | *dst = '\0'; |
| 297 | } |
| 298 | |
| 299 | /* convert char nc into oc's case; mostly used by strcasecpy */ |
| 300 | char |
no outgoing calls
no test coverage detected