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