diff options
author | lukem <lukem@pkgsrc.org> | 2007-07-23 11:45:51 +0000 |
---|---|---|
committer | lukem <lukem@pkgsrc.org> | 2007-07-23 11:45:51 +0000 |
commit | 91b7757560c7968d4203ae96869c4b14bd925488 (patch) | |
tree | 9067a545b6ad1d797399c0f8b261277cf19a1dd3 | |
parent | 9abe1b1af768a40ae4413c7f330e6cb3d2c56be7 (diff) | |
download | pkgsrc-91b7757560c7968d4203ae96869c4b14bd925488.tar.gz |
Update to tnftp 20070806.
Notable changes:
- Implement '-s srcaddr' to set the local IP address for all connections.
- Support '-q quittime' when waiting for server replies.
- Use IEC 60027-2 "KiB", "MiB" (etc) instead of "KB", "MB", ...
- Portability fixes, including for FreeBSD, Mac OS X, and Solaris.
-rw-r--r-- | net/tnftp/files/libnetbsd/glob.c | 41 | ||||
-rw-r--r-- | net/tnftp/files/libnetbsd/inet_ntop.c | 29 | ||||
-rw-r--r-- | net/tnftp/files/libnetbsd/inet_pton.c | 33 |
3 files changed, 53 insertions, 50 deletions
diff --git a/net/tnftp/files/libnetbsd/glob.c b/net/tnftp/files/libnetbsd/glob.c index c2635cb7841..17306aacfb7 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.1.1.4 2007/07/23 11:45:51 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..621f5026d17 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.1.1.4 2007/07/23 11:45:51 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..4a28fd2398b 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.1.1.4 2007/07/23 11:45:52 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 */ |