* Concatenate src on the end of dst. At most strlen(dst)+n+1 bytes * are written at dst (at most n+1 bytes being appended). Return dst. */
| 43 | * are written at dst (at most n+1 bytes being appended). Return dst. |
| 44 | */ |
| 45 | char * |
| 46 | strncat(char *dst, const char *src, size_t n) |
| 47 | { |
| 48 | |
| 49 | if (n != 0) { |
| 50 | char *d = dst; |
| 51 | const char *s = src; |
| 52 | |
| 53 | while (*d != 0) |
| 54 | d++; |
| 55 | do { |
| 56 | if ((*d = *s++) == '\0') |
| 57 | break; |
| 58 | d++; |
| 59 | } while (--n != 0); |
| 60 | *d = '\0'; |
| 61 | } |
| 62 | return (dst); |
| 63 | } |
no outgoing calls
no test coverage detected