source: rtems/cpukit/libcsupport/src/strlcat.c @ c9bb60a

4.115
Last change on this file since c9bb60a was c9bb60a, checked in by Alex Ivanov <alexivanov97@…>, on 12/11/12 at 11:49:45

libcsupport: GCI Doxygen Task #7

http://www.google-melange.com/gci/task/view/google/gci2012/7975223

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief Concatenate a Strings
5 *  @ingroup libcsupport
6 */
7
8/*
9 * Copyright (c) 1999 The Australian National University.
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms are permitted
13 * provided that the above copyright notice and this paragraph are
14 * duplicated in all such forms and that any documentation,
15 * advertising materials, and other materials related to such
16 * distribution and use acknowledge that the software was developed
17 * by the Australian National University.  The name of the University
18 * may not be used to endorse or promote products derived from this
19 * software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
21 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
22 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
23 */
24
25#if HAVE_CONFIG_H
26#include "config.h"
27#endif
28
29#include <string.h>
30
31#ifndef HAVE_STRLCAT
32
33/**
34 *  like strcat/strncat, doesn't overflow destination buffer,
35 *  always leaves destination null-terminated (for len > 0).
36 */
37size_t
38strlcat(
39    char *dest,
40    const char *src,
41    size_t len )
42{
43    size_t dlen = strlen(dest);
44
45    return dlen + strlcpy(dest + dlen, src, (len > dlen? len - dlen: 0));
46}
47#endif
Note: See TracBrowser for help on using the repository browser.