diff options
author | Damien Miller <djm@mindrot.org> | 2003-05-18 22:24:09 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2003-05-18 22:24:09 +1000 |
commit | e323df6c4851b04386e747a009474f469fe97137 (patch) | |
tree | 2c4209855f9ed24545b1add919db8319b34ec992 /openbsd-compat/strlcpy.c | |
parent | 0b8e9006d87075968dc402afa0f6ca359184b83b (diff) |
- (djm) Sync openbsd-compat/ with OpenBSD CVS head
Diffstat (limited to 'openbsd-compat/strlcpy.c')
-rw-r--r-- | openbsd-compat/strlcpy.c | 40 |
1 files changed, 13 insertions, 27 deletions
diff --git a/openbsd-compat/strlcpy.c b/openbsd-compat/strlcpy.c index 2f87eca44..fbb4f8ae2 100644 --- a/openbsd-compat/strlcpy.c +++ b/openbsd-compat/strlcpy.c | |||
@@ -1,37 +1,26 @@ | |||
1 | /* $OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp $ */ | 1 | /* $OpenBSD: strlcpy.c,v 1.7 2003/04/12 21:56:39 millert Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> | 4 | * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> |
5 | * All rights reserved. | ||
6 | * | 5 | * |
7 | * Redistribution and use in source and binary forms, with or without | 6 | * Permission to use, copy, modify, and distribute this software for any |
8 | * modification, are permitted provided that the following conditions | 7 | * purpose with or without fee is hereby granted, provided that the above |
9 | * are met: | 8 | * copyright notice and this permission notice appear in all copies. |
10 | * 1. Redistributions of source code must retain the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer. | ||
12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer in the | ||
14 | * documentation and/or other materials provided with the distribution. | ||
15 | * 3. The name of the author may not be used to endorse or promote products | ||
16 | * derived from this software without specific prior written permission. | ||
17 | * | 9 | * |
18 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, | 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL |
19 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY | 11 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES |
20 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | 12 | * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE |
21 | * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 13 | * FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION |
23 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | 15 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
24 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 16 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||
26 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||
27 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
28 | */ | 17 | */ |
29 | 18 | ||
30 | #include "includes.h" | 19 | #include "includes.h" |
31 | #ifndef HAVE_STRLCPY | 20 | #ifndef HAVE_STRLCPY |
32 | 21 | ||
33 | #if defined(LIBC_SCCS) && !defined(lint) | 22 | #if defined(LIBC_SCCS) && !defined(lint) |
34 | static char *rcsid = "$OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp $"; | 23 | static char *rcsid = "$OpenBSD: strlcpy.c,v 1.7 2003/04/12 21:56:39 millert Exp $"; |
35 | #endif /* LIBC_SCCS and not lint */ | 24 | #endif /* LIBC_SCCS and not lint */ |
36 | 25 | ||
37 | #include <sys/types.h> | 26 | #include <sys/types.h> |
@@ -44,10 +33,7 @@ static char *rcsid = "$OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp | |||
44 | * Returns strlen(src); if retval >= siz, truncation occurred. | 33 | * Returns strlen(src); if retval >= siz, truncation occurred. |
45 | */ | 34 | */ |
46 | size_t | 35 | size_t |
47 | strlcpy(dst, src, siz) | 36 | strlcpy(char *dst, const char *src, size_t siz) |
48 | char *dst; | ||
49 | const char *src; | ||
50 | size_t siz; | ||
51 | { | 37 | { |
52 | register char *d = dst; | 38 | register char *d = dst; |
53 | register const char *s = src; | 39 | register const char *s = src; |