overwrite string, preserving old chars' case; for case-insensitive editions of makeplural() and makesingular(); src might be shorter, same length, or longer than dst */
| 320 | for case-insensitive editions of makeplural() and makesingular(); |
| 321 | src might be shorter, same length, or longer than dst */ |
| 322 | char * |
| 323 | strcasecpy(char *dst, const char *src) |
| 324 | { |
| 325 | char *result = dst; |
| 326 | int ic, oc, dst_exhausted = 0; |
| 327 | |
| 328 | /* while dst has characters, replace each one with corresponding |
| 329 | character from src, converting case in the process if they differ; |
| 330 | once dst runs out, propagate the case of its last character to any |
| 331 | remaining src; if dst starts empty, it must be a pointer to the |
| 332 | tail of some other string because we examine the char at dst[-1] */ |
| 333 | while ((ic = (int) *src++) != '\0') { |
| 334 | if (!dst_exhausted && !*dst) |
| 335 | dst_exhausted = 1; |
| 336 | oc = (int) *(dst - dst_exhausted); |
| 337 | *dst++ = chrcasecpy(oc, ic); |
| 338 | } |
| 339 | *dst = '\0'; |
| 340 | return result; |
| 341 | } |
| 342 | |
| 343 | /* return a name converted to possessive */ |
| 344 | char * |
nothing calls this directly
no test coverage detected