Module Name: othersrc
Committed By: lukem
Date: Sun Jan 31 06:10:20 UTC 2016
Modified Files:
othersrc/usr.bin/tnftp: ChangeLog THANKS configure configure.ac tnftp.h
tnftp_config.h.in
othersrc/usr.bin/tnftp/libnetbsd: Makefile.in
Added Files:
othersrc/usr.bin/tnftp/libnetbsd: vasprintf.c
Log Message:
Provide missing vasprintf().
vasprintf() is used by the https logic, and some platforms lack it.
Provide replacement based on Joerg's implementation in libnbcompat.
Fix provided by J Raynor on pkgsrc-users on 2016-01-08, with
some tweaks to the autoconf rules by me.
To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 othersrc/usr.bin/tnftp/ChangeLog
cvs rdiff -u -r1.7 -r1.8 othersrc/usr.bin/tnftp/THANKS
cvs rdiff -u -r1.46 -r1.47 othersrc/usr.bin/tnftp/configure
cvs rdiff -u -r1.31 -r1.32 othersrc/usr.bin/tnftp/configure.ac
cvs rdiff -u -r1.36 -r1.37 othersrc/usr.bin/tnftp/tnftp.h
cvs rdiff -u -r1.4 -r1.5 othersrc/usr.bin/tnftp/tnftp_config.h.in
cvs rdiff -u -r1.9 -r1.10 othersrc/usr.bin/tnftp/libnetbsd/Makefile.in
cvs rdiff -u -r0 -r1.1 othersrc/usr.bin/tnftp/libnetbsd/vasprintf.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: othersrc/usr.bin/tnftp/ChangeLog
diff -u othersrc/usr.bin/tnftp/ChangeLog:1.67 othersrc/usr.bin/tnftp/ChangeLog:1.68
--- othersrc/usr.bin/tnftp/ChangeLog:1.67 Sun Oct 4 06:20:58 2015
+++ othersrc/usr.bin/tnftp/ChangeLog Sun Jan 31 06:10:20 2016
@@ -1,4 +1,10 @@
-$NetBSD: ChangeLog,v 1.67 2015/10/04 06:20:58 lukem Exp $
+$NetBSD: ChangeLog,v 1.68 2016/01/31 06:10:20 lukem Exp $
+
+
+Sun Jan 31 06:01:43 UTC 2016 lukem
+
+ * Provide missing vasprintf().
+ Fix from J Raynor via pkgsrc-users.
Sun Oct 4 06:19:25 UTC 2015 lukem
@@ -519,6 +525,7 @@ Sat May 14 04:44:35 UTC 2005 lukem
* Fail if we can't find a library with tgetent (needed for libedit).
NetBSD PR pkg/28925.
+
* Improve quoting when using various autoconf macros.
* Merge NetBSD-ftp 20050513:
Index: othersrc/usr.bin/tnftp/THANKS
diff -u othersrc/usr.bin/tnftp/THANKS:1.7 othersrc/usr.bin/tnftp/THANKS:1.8
--- othersrc/usr.bin/tnftp/THANKS:1.7 Fri Oct 31 04:24:30 2014
+++ othersrc/usr.bin/tnftp/THANKS Sun Jan 31 06:10:20 2016
@@ -23,6 +23,7 @@ Hauke Fath
Havard Eidnes
Hubert Feyrer
ITOH Yasufumi
+J Raynor
Jared McNeill
Jason R. Thorpe
John Hawkinson
Index: othersrc/usr.bin/tnftp/configure
diff -u othersrc/usr.bin/tnftp/configure:1.46 othersrc/usr.bin/tnftp/configure:1.47
--- othersrc/usr.bin/tnftp/configure:1.46 Sun Oct 4 06:17:41 2015
+++ othersrc/usr.bin/tnftp/configure Sun Jan 31 06:10:20 2016
@@ -13,7 +13,7 @@
# gives unlimited permission to copy, distribute and modify it.
#
#
-# Copyright (c) 1999-2015 The NetBSD Foundation, Inc.
+# Copyright (c) 1999-2016 The NetBSD Foundation, Inc.
# All rights reserved.
#
## -------------------- ##
@@ -1526,7 +1526,7 @@ This configure script is free software;
gives unlimited permission to copy, distribute and modify it.
-Copyright (c) 1999-2015 The NetBSD Foundation, Inc.
+Copyright (c) 1999-2016 The NetBSD Foundation, Inc.
All rights reserved.
_ACEOF
@@ -3174,6 +3174,8 @@ fi
+
+
#
# Checks for programs.
#
@@ -14390,6 +14392,19 @@ esac
fi
+ac_fn_c_check_func "$LINENO" "vasprintf" "ac_cv_func_vasprintf"
+if test "x$ac_cv_func_vasprintf" = xyes; then :
+ $as_echo "#define HAVE_VASPRINTF 1" >>confdefs.h
+
+else
+ case " $LIBOBJS " in
+ *" vasprintf.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS vasprintf.$ac_objext"
+ ;;
+esac
+
+fi
+
for ac_func in getcwd gethostbyaddr gethostbyname gethostbyname2 gethostname \
getpass getpassphrase getpgrp gettimeofday isascii \
@@ -14603,6 +14618,84 @@ fi
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for va_copy" >&5
+$as_echo_n "checking for va_copy... " >&6; }
+if test "$cross_compiling" = yes; then :
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+$accheck_includes
+
+int
+main ()
+{
+
+va_list ap, ap2;
+va_copy(ap2, ap);
+return 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ $as_echo "#define HAVE_VA_COPY 1" >>confdefs.h
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_va_copy" >&5
+$as_echo_n "checking for __builtin_va_copy... " >&6; }
+if test "$cross_compiling" = yes; then :
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+$accheck_includes
+
+int
+main ()
+{
+
+va_list ap, ap2;
+__builtin_va_copy(ap2, ap);
+return 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ $as_echo "#define HAVE___BUILTIN_VA_COPY 1" >>confdefs.h
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
if test "$ac_cv_func_strptime" = yes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if strptime() needs separators between conversions" >&5
$as_echo_n "checking if strptime() needs separators between conversions... " >&6; }
Index: othersrc/usr.bin/tnftp/configure.ac
diff -u othersrc/usr.bin/tnftp/configure.ac:1.31 othersrc/usr.bin/tnftp/configure.ac:1.32
--- othersrc/usr.bin/tnftp/configure.ac:1.31 Sun Oct 4 05:16:25 2015
+++ othersrc/usr.bin/tnftp/configure.ac Sun Jan 31 06:10:20 2016
@@ -1,4 +1,4 @@
-# $NetBSD: configure.ac,v 1.31 2015/10/04 05:16:25 lukem Exp $
+# $NetBSD: configure.ac,v 1.32 2016/01/31 06:10:20 lukem Exp $
#
# Process this file with autoconf to produce a configure script.
@@ -6,10 +6,10 @@ AC_INIT([tnftp], [20151004], [lukem@NetB
AC_PREREQ([2.69])
AC_COPYRIGHT([
-Copyright (c) 1999-2015 The NetBSD Foundation, Inc.
+Copyright (c) 1999-2016 The NetBSD Foundation, Inc.
All rights reserved.
])
-AC_REVISION([$Revision: 1.31 $])
+AC_REVISION([$Revision: 1.32 $])
AS_SHELL_SANITIZE()
@@ -61,6 +61,10 @@ AH_TEMPLATE([HAVE_PRINTF_QD],
AH_TEMPLATE([HAVE_PRINTF_LONG_LONG],
[Define if 'long long' is supported and
*printf() supports %lld or %qd to print them.])
+AH_TEMPLATE([HAVE_VA_COPY],
+ [Define to 1 if the 'va_copy' function is supported.])
+AH_TEMPLATE([HAVE___BUILTIN_VA_COPY],
+ [Define to 1 if the '__builtin_va_copy' function is supported.])
AH_TEMPLATE([USE_INET6],
[Define if using IPv6 support.])
AH_TEMPLATE([USE_SOCKS],
@@ -298,7 +302,7 @@ AC_FUNC_STRCOLL()
AC_REPLACE_FUNCS([dirname err fgetln getaddrinfo getnameinfo \
inet_ntop inet_pton mkstemp setprogname sl_init snprintf \
strdup strerror strlcat strlcpy strptime strsep strunvis \
- strvis timegm usleep utimes])
+ strvis timegm usleep utimes vasprintf])
AC_CHECK_FUNCS([getcwd gethostbyaddr gethostbyname gethostbyname2 gethostname \
getpass getpassphrase getpgrp gettimeofday isascii \
memchr memmove memset realpath regcomp \
@@ -363,6 +367,30 @@ AC_CHECK_FUNC([poll],
[AC_DEFINE([HAVE_POLL], [1])],
[$accheck_includes])])
+AC_MSG_CHECKING([for va_copy])
+AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+$accheck_includes
+]], [[
+va_list ap, ap2;
+va_copy(ap2, ap);
+return 0;
+]])],
+ [AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_VA_COPY], [1])],
+ [AC_MSG_RESULT([no])])
+
+AC_MSG_CHECKING([for __builtin_va_copy])
+AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+$accheck_includes
+]], [[
+va_list ap, ap2;
+__builtin_va_copy(ap2, ap);
+return 0;
+]])],
+ [AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE___BUILTIN_VA_COPY], [1])],
+ [AC_MSG_RESULT([no])])
+
AS_IF([test "$ac_cv_func_strptime" = yes],
[AC_MSG_CHECKING([if strptime() needs separators between conversions])
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
Index: othersrc/usr.bin/tnftp/tnftp.h
diff -u othersrc/usr.bin/tnftp/tnftp.h:1.36 othersrc/usr.bin/tnftp/tnftp.h:1.37
--- othersrc/usr.bin/tnftp/tnftp.h:1.36 Fri Oct 31 07:22:03 2014
+++ othersrc/usr.bin/tnftp/tnftp.h Sun Jan 31 06:10:20 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: tnftp.h,v 1.36 2014/10/31 07:22:03 lukem Exp $ */
+/* $NetBSD: tnftp.h,v 1.37 2016/01/31 06:10:20 lukem Exp $ */
#define FTP_PRODUCT PACKAGE_NAME
#define FTP_VERSION PACKAGE_VERSION
@@ -442,6 +442,10 @@ char *strsep(char **stringp, const cha
int utimes(const char *, const struct timeval *);
#endif
+#if !defined(HAVE_VASPRINTF)
+int vasprintf(char **, const char *, va_list);
+#endif
+
#if !defined(HAVE_MEMMOVE)
# define memmove(a,b,c) bcopy((b),(a),(c))
/* XXX: add others #defines for borken systems? */
Index: othersrc/usr.bin/tnftp/tnftp_config.h.in
diff -u othersrc/usr.bin/tnftp/tnftp_config.h.in:1.4 othersrc/usr.bin/tnftp/tnftp_config.h.in:1.5
--- othersrc/usr.bin/tnftp/tnftp_config.h.in:1.4 Fri Oct 31 07:35:48 2014
+++ othersrc/usr.bin/tnftp/tnftp_config.h.in Sun Jan 31 06:10:20 2016
@@ -421,6 +421,12 @@
/* Define to 1 if you have the <utime.h> header file. */
#undef HAVE_UTIME_H
+/* Define to 1 if you have the `vasprintf' function. */
+#undef HAVE_VASPRINTF
+
+/* Define to 1 if the 'va_copy' function is supported. */
+#undef HAVE_VA_COPY
+
/* Define to 1 if you have the `vfork' function. */
#undef HAVE_VFORK
@@ -436,6 +442,9 @@
/* Define to 1 if `vfork' works. */
#undef HAVE_WORKING_VFORK
+/* Define to 1 if the '__builtin_va_copy' function is supported. */
+#undef HAVE___BUILTIN_VA_COPY
+
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
Index: othersrc/usr.bin/tnftp/libnetbsd/Makefile.in
diff -u othersrc/usr.bin/tnftp/libnetbsd/Makefile.in:1.9 othersrc/usr.bin/tnftp/libnetbsd/Makefile.in:1.10
--- othersrc/usr.bin/tnftp/libnetbsd/Makefile.in:1.9 Sun May 5 13:21:06 2013
+++ othersrc/usr.bin/tnftp/libnetbsd/Makefile.in Sun Jan 31 06:10:20 2016
@@ -39,7 +39,8 @@ DIST_COMMON = $(srcdir)/Makefile.am $(sr
err.c fgetln.c getaddrinfo.c getnameinfo.c glob.c inet_ntop.c \
inet_pton.c mkstemp.c setprogname.c sl_init.c snprintf.c \
strdup.c strerror.c strlcat.c strlcpy.c strptime.c strsep.c \
- strtoll.c strunvis.c strvis.c timegm.c usleep.c utimes.c
+ strtoll.c strunvis.c strvis.c timegm.c usleep.c utimes.c \
+ vasprintf.c
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/buildaux/ax_check_openssl.m4 \
$(top_srcdir)/buildaux/libtool.m4 \
@@ -300,6 +301,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/timegm.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/usleep.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/utimes.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/vasprintf.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
Added files:
Index: othersrc/usr.bin/tnftp/libnetbsd/vasprintf.c
diff -u /dev/null othersrc/usr.bin/tnftp/libnetbsd/vasprintf.c:1.1
--- /dev/null Sun Jan 31 06:10:20 2016
+++ othersrc/usr.bin/tnftp/libnetbsd/vasprintf.c Sun Jan 31 06:10:20 2016
@@ -0,0 +1,95 @@
+/* $NetBSD: vasprintf.c,v 1.1 2016/01/31 06:10:20 lukem Exp $ */
+/* from: NetBSD: asprintf.c,v 1.3 2012/07/02 16:02:53 joerg Exp */
+
+/*-
+ * Copyright (c) 2007 Joerg Sonnenberger <[email protected]>.
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``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
+ * COPYRIGHT HOLDERS OR CONTRIBUTORS 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"
+
+int
+vasprintf(char **ret, const char *fmt, va_list ap)
+{
+ char *buf, *new_buf;
+ size_t len;
+ int retval;
+ va_list ap2;
+
+ len = 128;
+ buf = malloc(len);
+ if (buf == NULL) {
+ *ret = NULL;
+ return -1;
+ }
+
+#if defined(HAVE_VA_COPY)
+ va_copy(ap2, ap);
+#define my_va_end(ap2) va_end(ap2)
+#elif defined(HAVE___BUILTIN_VA_COPY)
+ __builtin_va_copy(ap2, ap);
+#define my_va_end(ap2) __builtin_va_end(ap2)
+#else
+ ap2 = ap;
+#define my_va_end(ap2) do {} while (0)
+#endif
+ retval = vsnprintf(buf, len, fmt, ap);
+ if (retval < 0) {
+ free(buf);
+ *ret = NULL;
+ va_end(ap2);
+ return -1;
+ }
+
+ if (retval < len) {
+ new_buf = realloc(buf, retval + 1);
+ if (new_buf == NULL)
+ *ret = buf;
+ else
+ *ret = new_buf;
+ my_va_end(ap2);
+ return retval;
+ }
+
+ len = (size_t)retval + 1;
+ free(buf);
+ buf = malloc(len);
+ if (buf == NULL) {
+ *ret = NULL;
+ my_va_end(ap2);
+ return -1;
+ }
+ retval = vsnprintf(buf, len, fmt, ap2);
+ my_va_end(ap2);
+ if (retval != len - 1) {
+ free(buf);
+ *ret = NULL;
+ return -1;
+ }
+ *ret = buf;
+ return retval;
+}