diff options
Diffstat (limited to 'net/tnftp/files/libnetbsd')
28 files changed, 110 insertions, 308 deletions
diff --git a/net/tnftp/files/libnetbsd/Makefile.in b/net/tnftp/files/libnetbsd/Makefile.in index 7cc3d64d5b2..5ea81073630 100644 --- a/net/tnftp/files/libnetbsd/Makefile.in +++ b/net/tnftp/files/libnetbsd/Makefile.in @@ -1,4 +1,4 @@ -# NetBSD: Makefile.in,v 1.5 2005/06/10 04:36:12 lukem Exp +# $NetBSD: Makefile.in,v 1.4 2007/08/07 02:06:58 lukem Exp $ # srcdir = @srcdir@ diff --git a/net/tnftp/files/libnetbsd/err.c b/net/tnftp/files/libnetbsd/err.c index 64004688c56..429c6b60f47 100644 --- a/net/tnftp/files/libnetbsd/err.c +++ b/net/tnftp/files/libnetbsd/err.c @@ -1,4 +1,4 @@ -/* NetBSD: err.c,v 1.4 2005/05/11 01:01:56 lukem Exp */ +/* $NetBSD: err.c,v 1.3 2007/08/07 02:06:58 lukem Exp $ */ /* * Copyright 1997-2000 Luke Mewburn <lukem@NetBSD.org>. diff --git a/net/tnftp/files/libnetbsd/fgetln.c b/net/tnftp/files/libnetbsd/fgetln.c index 25bfe98391c..1fa6c30b553 100644 --- a/net/tnftp/files/libnetbsd/fgetln.c +++ b/net/tnftp/files/libnetbsd/fgetln.c @@ -1,4 +1,4 @@ -/* NetBSD: fgetln.c,v 1.2 2003/02/28 10:44:46 lukem Exp */ +/* $NetBSD: fgetln.c,v 1.3 2007/08/07 02:06:58 lukem Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -15,11 +15,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its + * 3. Neither the name of The NetBSD Foundation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * @@ -56,8 +52,8 @@ fgetln(fp, len) if (fgets(buf, bufsiz, fp) == NULL) return NULL; - *len = 0; + *len = 0; while ((ptr = strchr(&buf[*len], '\n')) == NULL) { size_t nbufsiz = bufsiz + BUFSIZ; char *nbuf = realloc(buf, nbufsiz); diff --git a/net/tnftp/files/libnetbsd/fparseln.c b/net/tnftp/files/libnetbsd/fparseln.c deleted file mode 100644 index 207b35ee064..00000000000 --- a/net/tnftp/files/libnetbsd/fparseln.c +++ /dev/null @@ -1,207 +0,0 @@ -/* NetBSD: fparseln.c,v 1.3 2005/05/11 01:01:56 lukem Exp */ -/* from NetBSD: fparseln.c,v 1.5 1997/12/01 02:58:41 lukem Exp */ - -/* - * Copyright (c) 1997 Christos Zoulas. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Christos Zoulas. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "tnftp.h" - -static int isescaped(const char *, const char *, int); - -/* isescaped(): - * Return true if the character in *p that belongs to a string - * that starts in *sp, is escaped by the escape character esc. - */ -static int -isescaped(const char *sp, const char *p, int esc) -{ - const char *cp; - size_t ne; - - /* No escape character */ - if (esc == '\0') - return 1; - - /* Count the number of escape characters that precede ours */ - for (ne = 0, cp = p; --cp >= sp && *cp == esc; ne++) - continue; - - /* Return true if odd number of escape characters */ - return (ne & 1) != 0; -} - - -/* fparseln(): - * Read a line from a file parsing continuations ending in \ - * and eliminating trailing newlines, or comments starting with - * the comment char. - */ -char * -fparseln(FILE *fp, size_t *size, size_t *lineno, const char str[3], int flags) -{ - static const char dstr[3] = { '\\', '\\', '#' }; - - size_t s, len; - char *buf; - char *ptr, *cp; - int cnt; - char esc, con, nl, com; - - len = 0; - buf = NULL; - cnt = 1; - - if (str == NULL) - str = dstr; - - esc = str[0]; - con = str[1]; - com = str[2]; - /* - * XXX: it would be cool to be able to specify the newline character, - * but unfortunately, fgetln does not let us - */ - nl = '\n'; - - while (cnt) { - cnt = 0; - - if (lineno) - (*lineno)++; - - if ((ptr = fgetln(fp, &s)) == NULL) - break; - - if (s && com) { /* Check and eliminate comments */ - for (cp = ptr; cp < ptr + s; cp++) - if (*cp == com && !isescaped(ptr, cp, esc)) { - s = cp - ptr; - cnt = s == 0 && buf == NULL; - break; - } - } - - if (s && nl) { /* Check and eliminate newlines */ - cp = &ptr[s - 1]; - - if (*cp == nl) - s--; /* forget newline */ - } - - if (s && con) { /* Check and eliminate continuations */ - cp = &ptr[s - 1]; - - if (*cp == con && !isescaped(ptr, cp, esc)) { - s--; /* forget escape */ - cnt = 1; - } - } - - if (s == 0 && buf != NULL) - continue; - - if ((cp = realloc(buf, len + s + 1)) == NULL) { - free(buf); - return NULL; - } - buf = cp; - - (void) memcpy(buf + len, ptr, s); - len += s; - buf[len] = '\0'; - } - - if ((flags & FPARSELN_UNESCALL) != 0 && esc && buf != NULL && - strchr(buf, esc) != NULL) { - ptr = cp = buf; - while (cp[0] != '\0') { - int skipesc; - - while (cp[0] != '\0' && cp[0] != esc) - *ptr++ = *cp++; - if (cp[0] == '\0' || cp[1] == '\0') - break; - - skipesc = 0; - if (cp[1] == com) - skipesc += (flags & FPARSELN_UNESCCOMM); - if (cp[1] == con) - skipesc += (flags & FPARSELN_UNESCCONT); - if (cp[1] == esc) - skipesc += (flags & FPARSELN_UNESCESC); - if (cp[1] != com && cp[1] != con && cp[1] != esc) - skipesc = (flags & FPARSELN_UNESCREST); - - if (skipesc) - cp++; - else - *ptr++ = *cp++; - *ptr++ = *cp++; - } - *ptr = '\0'; - len = strlen(buf); - } - - if (size) - *size = len; - return buf; -} - -#ifdef TEST - -int main(int, char *[]); - -int -main(int argc, char *argv[]) -{ - char *ptr; - size_t size, line; - - line = 0; - while ((ptr = fparseln(stdin, &size, &line, NULL, - FPARSELN_UNESCALL)) != NULL) - printf("line %d (%d) |%s|\n", line, size, ptr); - return 0; -} - -/* - -# This is a test -line 1 -line 2 \ -line 3 # Comment -line 4 \# Not comment \\\\ - -# And a comment \ -line 5 \\\ -line 6 - -*/ - -#endif /* TEST */ diff --git a/net/tnftp/files/libnetbsd/fseeko.c b/net/tnftp/files/libnetbsd/fseeko.c index e6752d7469f..f4390bb2f0d 100644 --- a/net/tnftp/files/libnetbsd/fseeko.c +++ b/net/tnftp/files/libnetbsd/fseeko.c @@ -1,4 +1,4 @@ -/* NetBSD: fseeko.c,v 1.4 2005/05/11 01:01:56 lukem Exp */ +/* $NetBSD: fseeko.c,v 1.3 2007/08/07 02:06:59 lukem Exp $ */ /* * Copyright 2002 Luke Mewburn <lukem@NetBSD.org>. diff --git a/net/tnftp/files/libnetbsd/ftpglob.h b/net/tnftp/files/libnetbsd/ftpglob.h index 044dad5c22f..85e91da0813 100644 --- a/net/tnftp/files/libnetbsd/ftpglob.h +++ b/net/tnftp/files/libnetbsd/ftpglob.h @@ -1,5 +1,5 @@ -/* NetBSD: ftpglob.h,v 1.3 2005/05/16 05:45:40 lukem Exp */ -/* from NetBSD: glob.h,v 1.19 2005/02/03 04:39:32 perry Exp */ +/* $NetBSD: ftpglob.h,v 1.4 2007/08/07 02:06:59 lukem Exp $ */ +/* from NetBSD: glob.h,v 1.21 2006/03/26 18:11:22 christos Exp */ /* * Copyright (c) 1989, 1993 @@ -38,10 +38,17 @@ #ifndef _GLOB_H_ #define _GLOB_H_ +#ifndef __gl_size_t +#define __gl_size_t size_t +#endif +#ifndef __gl_stat_t +#define __gl_stat_t struct stat +#endif + typedef struct { - int gl_pathc; /* Count of total paths so far. */ - int gl_matchc; /* Count of paths matching pattern. */ - int gl_offs; /* Reserved at beginning of gl_pathv. */ + __gl_size_t gl_pathc; /* Count of total paths so far. */ + __gl_size_t gl_matchc; /* Count of paths matching pattern. */ + __gl_size_t gl_offs; /* Reserved at beginning of gl_pathv. */ int gl_flags; /* Copy of flags parameter to glob. */ char **gl_pathv; /* List of paths matching pattern. */ /* Copy of errfunc parameter to glob. */ @@ -55,8 +62,8 @@ typedef struct { void (*gl_closedir)(void *); struct dirent *(*gl_readdir)(void *); void *(*gl_opendir)(const char *); - int (*gl_lstat)(const char *, struct stat *); - int (*gl_stat)(const char *, struct stat *); + int (*gl_lstat)(const char *, __gl_stat_t *); + int (*gl_stat)(const char *, __gl_stat_t *); } glob_t; #define GLOB_APPEND 0x0001 /* Append to output from previous call. */ diff --git a/net/tnftp/files/libnetbsd/ftpvis.h b/net/tnftp/files/libnetbsd/ftpvis.h index acb1b4e3bc2..e4f10274ebb 100644 --- a/net/tnftp/files/libnetbsd/ftpvis.h +++ b/net/tnftp/files/libnetbsd/ftpvis.h @@ -1,4 +1,4 @@ -/* NetBSD: ftpvis.h,v 1.3 2005/05/16 13:25:48 lukem Exp */ +/* $NetBSD: ftpvis.h,v 1.4 2007/08/07 02:06:59 lukem Exp $ */ /* from NetBSD: vis.h,v 1.15 2005/02/03 04:39:32 perry Exp */ /*- diff --git a/net/tnftp/files/libnetbsd/getaddrinfo.c b/net/tnftp/files/libnetbsd/getaddrinfo.c index 82f8139ca90..736044fad04 100644 --- a/net/tnftp/files/libnetbsd/getaddrinfo.c +++ b/net/tnftp/files/libnetbsd/getaddrinfo.c @@ -1,4 +1,4 @@ -/* NetBSD: getaddrinfo.c,v 1.3 2005/05/11 01:01:56 lukem Exp */ +/* $NetBSD: getaddrinfo.c,v 1.3 2007/08/07 02:06:59 lukem Exp $ */ /* from ? */ /* @@ -225,7 +225,7 @@ do { \ #define MATCH(x, y, w) \ ((x) == (y) || (/*CONSTCOND*/(w) && ((x) == ANY || (y) == ANY))) -char * +const char * gai_strerror(int ecode) { if (ecode < 0 || ecode > EAI_MAX) @@ -571,14 +571,14 @@ explore_fqdn(const struct addrinfo *pai, const char *hostname, hp = getipnodebyname(hostname, pai->ai_family, pai->ai_flags & AI_ADDRCONFIG, &h_error); #else -#if HAVE_GETHOSTBYNAME2 +#if defined(HAVE_GETHOSTBYNAME2) hp = gethostbyname2(hostname, pai->ai_family); #else if (pai->ai_family != AF_INET) return 0; hp = gethostbyname(hostname); -#endif /*HAVE_GETHOSTBYNAME2*/ -#if HAVE_H_ERRNO +#endif /* defined(HAVE_GETHOSTBYNAME2) */ +#if defined(HAVE_H_ERRNO) h_error = h_errno; #else h_error = EINVAL; @@ -919,7 +919,7 @@ get_ai(const struct addrinfo *pai, const struct afd *afd, const char *addr) memcpy(ai, pai, sizeof(struct addrinfo)); ai->ai_addr = (struct sockaddr *)(void *)(ai + 1); memset(ai->ai_addr, 0, (size_t)afd->a_socklen); -#if HAVE_SOCKADDR_SA_LEN +#if defined(HAVE_STRUCT_SOCKADDR_SA_LEN) ai->ai_addr->sa_len = afd->a_socklen; #endif ai->ai_addrlen = afd->a_socklen; diff --git a/net/tnftp/files/libnetbsd/getnameinfo.c b/net/tnftp/files/libnetbsd/getnameinfo.c index 897f4ce068e..41208c024bf 100644 --- a/net/tnftp/files/libnetbsd/getnameinfo.c +++ b/net/tnftp/files/libnetbsd/getnameinfo.c @@ -1,4 +1,4 @@ -/* NetBSD: getnameinfo.c,v 1.5 2005/06/01 11:48:49 lukem Exp */ +/* $NetBSD: getnameinfo.c,v 1.4 2007/08/07 02:06:59 lukem Exp $ */ /* from ? */ /* @@ -103,7 +103,7 @@ getnameinfo(const struct sockaddr *sa, socklen_t salen, if (sa == NULL) return ENI_NOSOCKET; -#if HAVE_SOCKADDR_SA_LEN +#if defined(HAVE_STRUCT_SOCKADDR_SA_LEN) if (sa->sa_len != salen) return ENI_SALEN; #endif diff --git a/net/tnftp/files/libnetbsd/glob.c b/net/tnftp/files/libnetbsd/glob.c index c2635cb7841..ce2ef2b3256 100644 --- a/net/tnftp/files/libnetbsd/glob.c +++ b/net/tnftp/files/libnetbsd/glob.c @@ -1,5 +1,5 @@ -/* NetBSD: glob.c,v 1.5 2005/06/01 11:48:49 lukem Exp */ -/* from NetBSD: __glob13.c,v 1.25 2003/08/07 16:42:45 agc Exp */ +/* $NetBSD: glob.c,v 1.4 2007/08/07 02:06:59 lukem Exp $ */ +/* from NetBSD: glob.c,v 1.16 2006/03/26 18:11:22 christos Exp */ /* * Copyright (c) 1989, 1993 @@ -77,7 +77,7 @@ #define SLASH '/' #define COMMA ',' -#ifndef DEBUG +#ifndef USE_8BIT_CHARS #define M_QUOTE 0x8000 #define M_PROTECT 0x4000 @@ -88,10 +88,10 @@ typedef unsigned short Char; #else -#define M_QUOTE 0x80 -#define M_PROTECT 0x40 -#define M_MASK 0xff -#define M_ASCII 0x7f +#define M_QUOTE (Char)0x80 +#define M_PROTECT (Char)0x40 +#define M_MASK (Char)0xff +#define M_ASCII (Char)0x7f typedef char Char; @@ -111,10 +111,10 @@ typedef char Char; static int compare(const void *, const void *); static int g_Ctoc(const Char *, char *, size_t); -static int g_lstat(Char *, struct stat *, glob_t *); +static int g_lstat(Char *, __gl_stat_t *, glob_t *); static DIR *g_opendir(Char *, glob_t *); static Char *g_strchr(const Char *, int); -static int g_stat(Char *, struct stat *, glob_t *); +static int g_stat(Char *, __gl_stat_t *, glob_t *); static int glob0(const Char *, glob_t *); static int glob1(Char *, glob_t *, size_t *); static int glob2(Char *, Char *, Char *, Char *, glob_t *, size_t *); @@ -388,11 +388,11 @@ static int glob0(const Char *pattern, glob_t *pglob) { const Char *qpatnext; - int c, error, oldpathc; + int c, error; + __gl_size_t oldpathc; Char *bufnext, patbuf[MAXPATHLEN+1]; - size_t limit; + size_t limit = 0; - limit = 0; if ((qpatnext = globtilde(pattern, patbuf, sizeof(patbuf), pglob)) == NULL) return GLOB_ABEND; @@ -497,7 +497,9 @@ glob1(Char *pattern, glob_t *pglob, size_t *limit) * we save one character so that we can use ptr >= limit, * in the general case when we are appending non nul chars only. */ - return(glob2(pathbuf, pathbuf, pathbuf + sizeof(pathbuf) - 1, pattern, + return(glob2(pathbuf, pathbuf, + pathbuf + (sizeof(pathbuf) / sizeof(*pathbuf)) - 1, + pattern, pglob, limit)); } @@ -510,7 +512,7 @@ static int glob2(Char *pathbuf, Char *pathend, Char *pathlim, Char *pattern, glob_t *pglob, size_t *limit) { - struct stat sb; + __gl_stat_t sb; Char *p, *q; int anymeta; @@ -687,8 +689,7 @@ static int globextend(const Char *path, glob_t *pglob, size_t *limit) { char **pathv; - int i; - size_t newsize, len; + size_t i, newsize, len; char *copy; const Char *p; @@ -701,7 +702,7 @@ globextend(const Char *path, glob_t *pglob, size_t *limit) if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) { /* first time around -- clear initial gl_offs items */ pathv += pglob->gl_offs; - for (i = pglob->gl_offs; --i >= 0; ) + for (i = pglob->gl_offs + 1; --i > 0; ) *--pathv = NULL; } pglob->gl_pathv = pathv; @@ -782,7 +783,7 @@ match(Char *name, Char *pat, Char *patend) void globfree(glob_t *pglob) { - int i; + size_t i; char **pp; if (pglob->gl_pathv != NULL) { @@ -815,7 +816,7 @@ g_opendir(Char *str, glob_t *pglob) } static int -g_lstat(Char *fn, struct stat *sb, glob_t *pglob) +g_lstat(Char *fn, __gl_stat_t *sb, glob_t *pglob) { char buf[MAXPATHLEN]; @@ -827,7 +828,7 @@ g_lstat(Char *fn, struct stat *sb, glob_t *pglob) } static int -g_stat(Char *fn, struct stat *sb, glob_t *pglob) +g_stat(Char *fn, __gl_stat_t *sb, glob_t *pglob) { char buf[MAXPATHLEN]; diff --git a/net/tnftp/files/libnetbsd/inet_ntop.c b/net/tnftp/files/libnetbsd/inet_ntop.c index ac2fde52109..3c22f1a2faf 100644 --- a/net/tnftp/files/libnetbsd/inet_ntop.c +++ b/net/tnftp/files/libnetbsd/inet_ntop.c @@ -1,5 +1,5 @@ -/* NetBSD: inet_ntop.c,v 1.6 2005/06/01 11:48:49 lukem Exp */ -/* from NetBSD: inet_ntop.c,v 1.2 2004/05/20 23:12:33 christos Exp */ +/* $NetBSD: inet_ntop.c,v 1.4 2007/08/07 02:06:59 lukem Exp $ */ +/* from NetBSD: inet_ntop.c,v 1.3 2006/05/10 21:53:15 mrg Exp */ /* * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") @@ -20,16 +20,17 @@ #include "tnftp.h" -#if HAVE_ARPA_NAMESER_H -#include <arpa/nameser.h> +#if defined(HAVE_ARPA_NAMESER_H) +# include <arpa/nameser.h> #endif - -#ifndef NS_IN6ADDRSZ -#define NS_IN6ADDRSZ 16 +#if !defined(NS_INADDRSZ) +# define NS_INADDRSZ 4 #endif - -#ifndef NS_INT16SZ -#define NS_INT16SZ 2 +#if !defined(NS_IN6ADDRSZ) +# define NS_IN6ADDRSZ 16 +#endif +#if !defined(NS_INT16SZ) +# define NS_INT16SZ 2 #endif /* @@ -38,7 +39,9 @@ */ static const char *inet_ntop4(const unsigned char *src, char *dst, socklen_t size); +#ifdef INET6 static const char *inet_ntop6(const unsigned char *src, char *dst, socklen_t size); +#endif /* INET6 */ /* char * * inet_ntop(af, src, dst, size) @@ -58,7 +61,7 @@ inet_ntop(int af, const void *src, char *dst, socklen_t size) #ifdef INET6 case AF_INET6: return (inet_ntop6(src, dst, size)); -#endif +#endif /* INET6 */ default: errno = EAFNOSUPPORT; return (NULL); @@ -127,6 +130,8 @@ inet_ntop6(const unsigned char *src, char *dst, socklen_t size) words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3)); best.base = -1; cur.base = -1; + best.len = -1; /* XXX gcc */ + cur.len = -1; /* XXX gcc */ for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { if (words[i] == 0) { if (cur.base == -1) @@ -203,4 +208,4 @@ inet_ntop6(const unsigned char *src, char *dst, socklen_t size) strlcpy(dst, tmp, size); return (dst); } -#endif +#endif /* INET6 */ diff --git a/net/tnftp/files/libnetbsd/inet_pton.c b/net/tnftp/files/libnetbsd/inet_pton.c index 9072c48a405..16a9f90c666 100644 --- a/net/tnftp/files/libnetbsd/inet_pton.c +++ b/net/tnftp/files/libnetbsd/inet_pton.c @@ -1,5 +1,5 @@ -/* NetBSD: inet_pton.c,v 1.5 2005/06/01 11:48:49 lukem Exp */ -/* from NetBSD: inet_pton.c,v 1.2 2004/05/20 23:12:33 christos Exp */ +/* $NetBSD: inet_pton.c,v 1.4 2007/08/07 02:06:59 lukem Exp $ */ +/* from NetBSD: inet_pton.c,v 1.3 2006/09/26 05:59:18 lukem Exp */ /* * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") @@ -20,20 +20,17 @@ #include "tnftp.h" -#if HAVE_ARPA_NAMESER_H -#include <arpa/nameser.h> +#if defined(HAVE_ARPA_NAMESER_H) +# include <arpa/nameser.h> #endif - -#ifndef NS_INADDRSZ -#define NS_INADDRSZ 4 +#if !defined(NS_INADDRSZ) +# define NS_INADDRSZ 4 #endif - -#ifndef NS_IN6ADDRSZ -#define NS_IN6ADDRSZ 16 +#if !defined(NS_IN6ADDRSZ) +# define NS_IN6ADDRSZ 16 #endif - -#ifndef NS_INT16SZ -#define NS_INT16SZ 2 +#if !defined(NS_INT16SZ) +# define NS_INT16SZ 2 #endif /* @@ -44,7 +41,7 @@ static int inet_pton4(const char *src, unsigned char *dst, int pton); #ifdef INET6 static int inet_pton6(const char *src, unsigned char *dst); -#endif +#endif /* INET6 */ /* int * inet_pton(af, src, dst) @@ -67,7 +64,7 @@ inet_pton(int af, const char *src, void *dst) #ifdef INET6 case AF_INET6: return (inet_pton6(src, dst)); -#endif +#endif /* INET6 */ default: errno = EAFNOSUPPORT; return (-1); @@ -94,7 +91,7 @@ inet_pton4(const char *src, unsigned char *dst, int pton) int n; unsigned char c; unsigned int parts[4]; - unsigned int *pp = parts; + register unsigned int *pp = parts; c = *src; for (;;) { @@ -249,7 +246,7 @@ inet_pton6(const char *src, unsigned char *dst) continue; } else if (*src == '\0') return (0); - if (tp + INT16SZ > endp) + if (tp + NS_INT16SZ > endp) return (0); *tp++ = (unsigned char) (val >> 8) & 0xff; *tp++ = (unsigned char) val & 0xff; @@ -292,4 +289,4 @@ inet_pton6(const char *src, unsigned char *dst) memcpy(dst, tmp, NS_IN6ADDRSZ); return (1); } -#endif +#endif /* INET6 */ diff --git a/net/tnftp/files/libnetbsd/mkstemp.c b/net/tnftp/files/libnetbsd/mkstemp.c index d1b40ea42b8..043d3a939a3 100644 --- a/net/tnftp/files/libnetbsd/mkstemp.c +++ b/net/tnftp/files/libnetbsd/mkstemp.c @@ -1,4 +1,4 @@ -/* NetBSD: mkstemp.c,v 1.5 2005/06/01 11:48:49 lukem Exp */ +/* $NetBSD: mkstemp.c,v 1.4 2007/08/07 02:06:59 lukem Exp $ */ /* from NetBSD: gettemp.c,v 1.13 2003/12/05 00:57:36 uebayasi Exp */ /* diff --git a/net/tnftp/files/libnetbsd/setprogname.c b/net/tnftp/files/libnetbsd/setprogname.c index 6e60d5d22ae..b4aab45aacd 100644 --- a/net/tnftp/files/libnetbsd/setprogname.c +++ b/net/tnftp/files/libnetbsd/setprogname.c @@ -1,4 +1,4 @@ -/* NetBSD: setprogname.c,v 1.3 2005/05/11 01:01:56 lukem Exp */ +/* $NetBSD: setprogname.c,v 1.3 2007/08/07 02:07:00 lukem Exp $ */ /* from NetBSD: setprogname.c,v 1.3 2002/01/31 19:21:58 tv Exp */ /*- diff --git a/net/tnftp/files/libnetbsd/sl_init.c b/net/tnftp/files/libnetbsd/sl_init.c index f1b64ecffd2..5520492463d 100644 --- a/net/tnftp/files/libnetbsd/sl_init.c +++ b/net/tnftp/files/libnetbsd/sl_init.c @@ -1,4 +1,4 @@ -/* NetBSD: sl_init.c,v 1.4 2005/05/16 06:37:47 lukem Exp */ +/* $NetBSD: sl_init.c,v 1.4 2007/08/07 02:07:00 lukem Exp $ */ /* from NetBSD: stringlist.c,v 1.10 2000/01/25 16:24:40 enami Exp */ /*- diff --git a/net/tnftp/files/libnetbsd/snprintf.c b/net/tnftp/files/libnetbsd/snprintf.c index 4765ca8751d..476f81215bb 100644 --- a/net/tnftp/files/libnetbsd/snprintf.c +++ b/net/tnftp/files/libnetbsd/snprintf.c @@ -1,4 +1,4 @@ -/* NetBSD: snprintf.c,v 1.4 2005/05/11 01:01:56 lukem Exp */ +/* $NetBSD: snprintf.c,v 1.3 2007/08/07 02:07:00 lukem Exp $ */ /* * Copyright Patrick Powell 1995 @@ -60,13 +60,13 @@ #include "tnftp.h" -#if HAVE_LONG_DOUBLE +#if defined(HAVE_LONG_DOUBLE) #define LDOUBLE long double #else #define LDOUBLE double #endif -#if HAVE_LONG_LONG +#if defined(HAVE_LONG_LONG_INT) #define LLONG long long #else #define LLONG long @@ -731,7 +731,7 @@ main(int argc, char *argv[]) "%+22.33d", "%01.3d", "%4d", -#if HAVE_LONG_LONG +#if defined(HAVE_LONG_LONG_INT) "%12lld", #endif NULL diff --git a/net/tnftp/files/libnetbsd/strdup.c b/net/tnftp/files/libnetbsd/strdup.c index 75a4005e263..bb1b73feb12 100644 --- a/net/tnftp/files/libnetbsd/strdup.c +++ b/net/tnftp/files/libnetbsd/strdup.c @@ -1,4 +1,4 @@ -/* NetBSD: strdup.c,v 1.4 2005/05/16 06:40:04 lukem Exp */ +/* $NetBSD: strdup.c,v 1.4 2007/08/07 02:07:00 lukem Exp $ */ /* from NetBSD: strdup.c,v 1.13 2003/08/07 16:43:50 agc Exp */ /* diff --git a/net/tnftp/files/libnetbsd/strerror.c b/net/tnftp/files/libnetbsd/strerror.c index 7d610c042fa..584abaf06ca 100644 --- a/net/tnftp/files/libnetbsd/strerror.c +++ b/net/tnftp/files/libnetbsd/strerror.c @@ -1,4 +1,4 @@ -/* NetBSD: strerror.c,v 1.3 2005/05/11 01:01:56 lukem Exp */ +/* $NetBSD: strerror.c,v 1.3 2007/08/07 02:07:00 lukem Exp $ */ #include "tnftp.h" diff --git a/net/tnftp/files/libnetbsd/strlcat.c b/net/tnftp/files/libnetbsd/strlcat.c index 523a8b2506d..6847412a971 100644 --- a/net/tnftp/files/libnetbsd/strlcat.c +++ b/net/tnftp/files/libnetbsd/strlcat.c @@ -1,4 +1,4 @@ -/* NetBSD: strlcat.c,v 1.4 2005/05/16 06:55:48 lukem Exp */ +/* $NetBSD: strlcat.c,v 1.4 2007/08/07 02:07:00 lukem Exp $ */ /* from NetBSD: strlcat.c,v 1.16 2003/10/27 00:12:42 lukem Exp */ /* from OpenBSD: strlcat.c,v 1.10 2003/04/12 21:56:39 millert Exp */ diff --git a/net/tnftp/files/libnetbsd/strlcpy.c b/net/tnftp/files/libnetbsd/strlcpy.c index 7f2d4d07438..1cfd33ed5b0 100644 --- a/net/tnftp/files/libnetbsd/strlcpy.c +++ b/net/tnftp/files/libnetbsd/strlcpy.c @@ -1,4 +1,4 @@ -/* NetBSD: strlcpy.c,v 1.4 2005/05/16 06:58:06 lukem Exp */ +/* $NetBSD: strlcpy.c,v 1.4 2007/08/07 02:07:00 lukem Exp $ */ /* from NetBSD: strlcpy.c,v 1.14 2003/10/27 00:12:42 lukem Exp */ /* from OpenBSD: strlcpy.c,v 1.7 2003/04/12 21:56:39 millert Exp */ diff --git a/net/tnftp/files/libnetbsd/strptime.c b/net/tnftp/files/libnetbsd/strptime.c index 87f5b251278..a316a6cd0a0 100644 --- a/net/tnftp/files/libnetbsd/strptime.c +++ b/net/tnftp/files/libnetbsd/strptime.c @@ -1,4 +1,4 @@ -/* NetBSD: strptime.c,v 1.3 2005/05/11 01:01:56 lukem Exp */ +/* $NetBSD: strptime.c,v 1.3 2007/08/07 02:07:00 lukem Exp $ */ /* from NetBSD: strptime.c,v 1.18 1999/04/29 02:58:30 tv Exp */ /*- @@ -275,20 +275,23 @@ literal: case 'p': /* The locale's equivalent of AM/PM. */ LEGAL_ALT(0); /* AM? */ - if (strcasecmp(am_pm[0], bp) == 0) { + len = strlen(am_pm[0]); + if (strncasecmp(am_pm[0], bp, len) == 0) { if (tm->tm_hour > 11) return (0); - bp += strlen(am_pm[0]); + bp += len; break; } + /* PM? */ - else if (strcasecmp(am_pm[1], bp) == 0) { + len = strlen(am_pm[1]); + if (strncasecmp(am_pm[1], bp, len) == 0) { if (tm->tm_hour > 11) return (0); tm->tm_hour += 12; - bp += strlen(am_pm[1]); + bp += len; break; } diff --git a/net/tnftp/files/libnetbsd/strsep.c b/net/tnftp/files/libnetbsd/strsep.c index 762915452be..f7c433e9085 100644 --- a/net/tnftp/files/libnetbsd/strsep.c +++ b/net/tnftp/files/libnetbsd/strsep.c @@ -1,4 +1,4 @@ -/* NetBSD: strsep.c,v 1.4 2005/05/16 08:51:51 lukem Exp */ +/* $NetBSD: strsep.c,v 1.4 2007/08/07 02:07:01 lukem Exp $ */ /* from NetBSD: strsep.c,v 1.14 2003/08/07 16:43:52 agc Exp */ /*- diff --git a/net/tnftp/files/libnetbsd/strtoll.c b/net/tnftp/files/libnetbsd/strtoll.c index f2801d826fa..923b7cdb123 100644 --- a/net/tnftp/files/libnetbsd/strtoll.c +++ b/net/tnftp/files/libnetbsd/strtoll.c @@ -1,4 +1,4 @@ -/* NetBSD: strtoll.c,v 1.4 2005/05/16 11:27:58 lukem Exp */ +/* $NetBSD: strtoll.c,v 1.4 2007/08/07 02:07:01 lukem Exp $ */ /* from NetBSD: strtoll.c,v 1.6 2003/10/27 00:12:42 lukem Exp */ /*- diff --git a/net/tnftp/files/libnetbsd/strunvis.c b/net/tnftp/files/libnetbsd/strunvis.c index 562a5395dfd..ecb2d05e0f4 100644 --- a/net/tnftp/files/libnetbsd/strunvis.c +++ b/net/tnftp/files/libnetbsd/strunvis.c @@ -1,4 +1,4 @@ -/* NetBSD: strunvis.c,v 1.5 2005/06/01 11:48:49 lukem Exp */ +/* $NetBSD: strunvis.c,v 1.4 2007/08/07 02:07:01 lukem Exp $ */ /* from NetBSD: unvis.c,v 1.27 2005/05/16 11:42:04 lukem Exp */ /*- diff --git a/net/tnftp/files/libnetbsd/strvis.c b/net/tnftp/files/libnetbsd/strvis.c index f98d4d2a96d..69a2bc97034 100644 --- a/net/tnftp/files/libnetbsd/strvis.c +++ b/net/tnftp/files/libnetbsd/strvis.c @@ -1,4 +1,4 @@ -/* NetBSD: strvis.c,v 1.8 2005/06/01 11:48:49 lukem Exp */ +/* $NetBSD: strvis.c,v 1.4 2007/08/07 02:07:01 lukem Exp $ */ /* from NetBSD: vis.c,v 1.33 2005/05/28 13:11:14 lukem Exp */ /*- diff --git a/net/tnftp/files/libnetbsd/timegm.c b/net/tnftp/files/libnetbsd/timegm.c index 094f8d1aaee..d625b84622f 100644 --- a/net/tnftp/files/libnetbsd/timegm.c +++ b/net/tnftp/files/libnetbsd/timegm.c @@ -1,4 +1,4 @@ -/* NetBSD: timegm.c,v 1.3 2005/05/11 01:01:56 lukem Exp */ +/* $NetBSD: timegm.c,v 1.3 2007/08/07 02:07:01 lukem Exp $ */ /* from ? */ #include "tnftp.h" diff --git a/net/tnftp/files/libnetbsd/usleep.c b/net/tnftp/files/libnetbsd/usleep.c index 233485a0616..976571bb3e5 100644 --- a/net/tnftp/files/libnetbsd/usleep.c +++ b/net/tnftp/files/libnetbsd/usleep.c @@ -1,4 +1,4 @@ -/* NetBSD: usleep.c,v 1.4 2005/05/16 13:21:43 lukem Exp */ +/* $NetBSD: usleep.c,v 1.5 2007/08/07 02:07:01 lukem Exp $ */ /*- * Copyright (c) 1999,2000,2005 The NetBSD Foundation, Inc. @@ -41,9 +41,9 @@ int usleep(unsigned int usec) { -#if HAVE_POLL +#if defined(HAVE_POLL) return (poll(NULL, 0, usec / 1000)); -#elif HAVE_SELECT +#elif defined(HAVE_SELECT) struct timeval tv; tv.tv_sec = 0; diff --git a/net/tnftp/files/libnetbsd/utimes.c b/net/tnftp/files/libnetbsd/utimes.c index eedc89dbc93..b130eac5911 100644 --- a/net/tnftp/files/libnetbsd/utimes.c +++ b/net/tnftp/files/libnetbsd/utimes.c @@ -1,4 +1,4 @@ -/* NetBSD: utimes.c,v 1.3 2005/05/11 01:01:56 lukem Exp */ +/* $NetBSD: utimes.c,v 1.4 2007/08/07 02:07:01 lukem Exp $ */ /*- * Copyright (c) 2004 The NetBSD Foundation, Inc. |