strncat.c (8fb3f3f68288ae2b1b53dd65e3dd673d83c80f4c) | strncat.c (ad906968153f7b35f2e92b49936a22f44d5aa0c0) |
---|---|
1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Chris Torek. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 33 unchanged lines hidden (view full) --- 42 43#include <string.h> 44 45/* 46 * Concatenate src on the end of dst. At most strlen(dst)+n+1 bytes 47 * are written at dst (at most n+1 bytes being appended). Return dst. 48 */ 49char * | 1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Chris Torek. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 33 unchanged lines hidden (view full) --- 42 43#include <string.h> 44 45/* 46 * Concatenate src on the end of dst. At most strlen(dst)+n+1 bytes 47 * are written at dst (at most n+1 bytes being appended). Return dst. 48 */ 49char * |
50strncat(dst, src, n) 51 char *dst; 52 const char *src; 53 size_t n; | 50strncat(char *__restrict dst, const char *__restrict src, size_t n) |
54{ 55 if (n != 0) { 56 char *d = dst; 57 const char *s = src; 58 59 while (*d != 0) 60 d++; 61 do { 62 if ((*d = *s++) == 0) 63 break; 64 d++; 65 } while (--n != 0); 66 *d = 0; 67 } 68 return (dst); 69} | 51{ 52 if (n != 0) { 53 char *d = dst; 54 const char *s = src; 55 56 while (*d != 0) 57 d++; 58 do { 59 if ((*d = *s++) == 0) 60 break; 61 d++; 62 } while (--n != 0); 63 *d = 0; 64 } 65 return (dst); 66} |