ReactOS 0.4.15-dev-7924-g5949c20
strlcat.c
Go to the documentation of this file.
1/* @(#)strlcat.c 1.1 10/04/26 Copyright 2010 J. Schilling */
2#include <schily/mconfig.h>
3#ifndef lint
4static UConst char sccsid[] =
5 "@(#)strlcat.c 1.1 10/04/26 Copyright 2010 J. Schilling";
6#endif
7/*
8 * strlcat() to be used if missing in libc
9 *
10 * Copyright (c) 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 *
20 * When distributing Covered Code, include this CDDL HEADER in each
21 * file and include the License file CDDL.Schily.txt from this distribution.
22 */
23
24#include <schily/standard.h>
25#include <schily/unistd.h>
26#include <schily/string.h>
27#include <schily/libport.h>
28
29#ifndef HAVE_STRLCAT
30
31EXPORT size_t
33 register char *s1;
34 register const char *s2;
35 register size_t len;
36{
37 const char *os1 = s1;
38 size_t olen = len;
39
40 if (len > 0) {
41 while (--len > 0 && *s1++ != '\0')
42 ;
43
44 if (len == 0)
45 return (olen + strlen(s2));
46
47 s1--;
48 len++;
49 while (--len > 0 && (*s1++ = *s2++) != '\0')
50 ;
51 if (len == 0) {
52 *s1 = '\0';
53 return (s1 - os1 + strlen(s2));
54 }
55 return (--s1 - os1);
56 }
57 return (strlen(s2));
58}
59#endif /* HAVE_STRLCAT */
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define UConst
Definition: ccomdefs.h:72
GLenum GLsizei len
Definition: glext.h:6722
struct S1 s1
struct S2 s2
static UConst char sccsid[]
Definition: strlcat.c:4
EXPORT size_t strlcat(char *s1, const char *s2, size_t len)
Definition: strlcat.c:32