1 /* @(#)wcsncat.c 1.3 10/05/06 Copyright 2006-2010 J. Schilling */ 2 #include <schily/mconfig.h> 3 #ifndef lint 4 static UConst char sccsid[] = 5 "@(#)wcsncat.c 1.3 10/05/06 Copyright 2006-2010 J. Schilling"; 6 #endif 7 /* 8 * wcsncat() to be used if missing in libc 9 * 10 * Copyright (c) 2006-2010 J. Schilling 11 */ 12 /* 13 * The contents of this file are subject to the terms of the 14 * Common Development and Distribution License, Version 1.0 only 15 * (the "License"). You may not use this file except in compliance 16 * with the License. 17 * 18 * See the file CDDL.Schily.txt in this distribution for details. 19 * A copy of the CDDL is also available via the Internet at 20 * http://www.opensource.org/licenses/cddl1.txt 21 * 22 * When distributing Covered Code, include this CDDL HEADER in each 23 * file and include the License file CDDL.Schily.txt from this distribution. 24 */ 25 26 #include <schily/standard.h> 27 #include <schily/unistd.h> 28 #include <schily/wchar.h> 29 #include <schily/schily.h> 30 31 #ifndef HAVE_WCSNCAT 32 33 EXPORT wchar_t * wcsncat(s1,s2,len)34wcsncat(s1, s2, len) 35 register wchar_t *s1; 36 register const wchar_t *s2; 37 register size_t len; 38 { 39 wchar_t *ret = s1; 40 41 42 if (len == 0) 43 return (ret); 44 45 while (*s1++ != '\0') 46 ; 47 s1--; 48 do { 49 if ((*s1++ = *s2++) == '\0') 50 return (ret); 51 } while (--len > 0); 52 *s1 = '\0'; 53 return (ret); 54 } 55 #endif /* HAVE_WCSNCAT */ 56