BUGS: Update. (Maybe remove old glob comment?) configure.in, new m4/gnu-source.m4: #define _GNU_SOURCE early. (This doesn't introduce a GNU dependency; it just makes sure GNU extensions are used if available, including in autoconf tests. This fixes the wcwidth test on glibc, which is only enabled when GNU extensions or XOPEN is defined.)
FileSetOutput.cc, QueueFeeder.cc, FileAccess.cc: remove #define _GNU_SOURCE. m4/needtrio.m4: add missing def. acconfig.h, m4/va_copy.m4: Add copy-by-value test; always either define VA_LIST or fail during autoconf, not compile. va_copy.m4 is self-contained again. FileSetOutput.h, FileSetOutput.cc: Add Suspend(), Resume(), Fg(), Bg(). Fixes stalls. (fixes to GetFileInfo.cc withheld until caching is sorted out) Something I'll probably work on gradually: moving test-related stuff from acconfig.h to the tests themselves. acconfig.h is deprecated; AH_VERBETIM is cleaner. It's not overly important, however. -- Glenn Maynard
#serial 2 # Make sure _GNU_SOURCE is defined where necessary: as early as possible # for configure-time tests, as well as for every source file that includes # config.h. # From Jim Meyering. AC_DEFUN(AC__GNU_SOURCE, [ # Make sure that _GNU_SOURCE is defined for all subsequent # configure-time compile tests. # This definition must be emitted (into confdefs.h) before any # test that involves compilation. cat >>confdefs.h <<\EOF #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif EOF # Emit this code into config.h.in. # The ifndef is to avoid redefinition warnings. AH_VERBATIM([_GNU_SOURCE], [#ifndef _GNU_SOURCE # define _GNU_SOURCE #endif]) ])
Index: BUGS =================================================================== RCS file: /home/lav/cvsroot/lftp/BUGS,v retrieving revision 1.2 diff -u -r1.2 BUGS --- BUGS 1999/11/03 13:23:05 1.2 +++ BUGS 2001/12/05 00:21:57 @@ -1,7 +1,6 @@ This file describes some limitations or misfeatures lftp has. +* cls status bar does not show progress of the list download. * Glob over ftp is unreliable (server dependent) when not only last path - component contains wildcards, e.g. */*. - -FIXED in 2.2.0. + component contains wildcards, e.g. */*. (FIXED in 2.2.0.) Index: acconfig.h =================================================================== RCS file: /home/lav/cvsroot/lftp/acconfig.h,v retrieving revision 1.28 diff -u -r1.28 acconfig.h --- acconfig.h 2001/12/03 10:13:11 1.28 +++ acconfig.h 2001/12/05 00:21:59 @@ -263,8 +263,4 @@ # define PRINTF_LIKE(n,m) #endif -#ifndef VA_COPY -# define VA_COPY(to,from) (memcpy(&(to),&(from),sizeof((to)))) -#endif - #endif /* CONFIG_H */ Index: configure.in =================================================================== RCS file: /home/lav/cvsroot/lftp/configure.in,v retrieving revision 1.116 diff -u -r1.116 configure.in --- configure.in 2001/12/03 10:13:11 1.116 +++ configure.in 2001/12/05 00:22:00 @@ -4,6 +4,10 @@ AM_INIT_AUTOMAKE(lftp, pre2.5.0) AM_CONFIG_HEADER(include/config.h) +# This doesn't *require* GNU extensions; it merely enables them if +# they're there. +AC__GNU_SOURCE + dnl Default AC_C_INLINE does not know about C++ m4_undefine([AC_C_INLINE]) AC_DEFUN([AC_C_INLINE],[LFTP_C_INLINE]) Index: m4/needtrio.m4 =================================================================== RCS file: /home/lav/cvsroot/lftp/m4/needtrio.m4,v retrieving revision 1.1 diff -u -r1.1 needtrio.m4 --- m4/needtrio.m4 2001/12/03 10:17:31 1.1 +++ m4/needtrio.m4 2001/12/05 00:22:01 @@ -13,6 +13,7 @@ { unsigned long long x=0,x1; long long y=0,y1; + char buf[128]; x=~x; sscanf("0","%llu",&x); Index: m4/va_copy.m4 =================================================================== RCS file: /home/lav/cvsroot/lftp/m4/va_copy.m4,v retrieving revision 1.1 diff -u -r1.1 va_copy.m4 --- m4/va_copy.m4 2001/12/03 10:17:31 1.1 +++ m4/va_copy.m4 2001/12/05 00:22:01 @@ -52,4 +52,69 @@ if test -n "$va_copy_func"; then AC_DEFINE_UNQUOTED(VA_COPY,$va_copy_func,[A 'va_copy' style function]) fi + + AC_CACHE_CHECK([whether va_lists can be copied by value],lftp_cv_va_val_copy,[ + AC_TRY_RUN([ + #include <stdarg.h> + #include <string.h> + void f (int i, ...) { + va_list args1, args2; + va_start (args1, i); + + memmove(&args2, &args1, sizeof(args)); + if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) + exit (1); + va_end (args1); va_end (args2); + } + int main() { + f (0, 42); + return 0; + }], + [lftp_cv_va_val_copy=yes], + [lftp_cv_va_val_copy=no], + []) + ]) + + if test x$lftp_cv_va_val_copy = xyes; then + AC_DEFINE(VA_VAL_COPY,1,[Define to 1 if va_lists can be copied by value]) + fi + + AC_CACHE_CHECK([whether va_lists can be copied by pointer],lftp_cv_va_ptr_copy,[ + AC_TRY_RUN([ + #include <stdarg.h> + void f (int i, ...) { + va_list args1, args2; + va_start (args1, i); + + *args2 = *args1; + if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) + exit (1); + va_end (args1); va_end (args2); + } + int main() { + f (0, 42); + return 0; + }], + [lftp_cv_va_val_copy=yes], + [lftp_cv_va_val_copy=no], + []) + ]) + + if test x$lftp_cv_va_ptr_copy = xyes; then + AC_DEFINE(VA_PTR_COPY,1,[Define to 1 if va_lists can be copied by pointer]) + fi + + if test x$lftp_cv_va_val_copy = xno -a x$lftp_cv_va_val_copy = xno -a \ + x$lftp_cv_va_copy = xno -a x$lftp_cv___va_copy = xno; then + AC_MSG_ERROR(Can't find a way to va_copy.) + fi + + AH_VERBATIM([OPT_VA_COPY],[#if !defined (VA_COPY) + # if defined (VA_PTR_COPY) + # define VA_COPY(ap1, ap2) (*(ap1) = *(ap2)) + # elif defined (VA_VAL_COPY) + # include <string.h> + # define VA_COPY(to,from) (memcpy(&(to),&(from),sizeof((to)))) + # endif + #endif /* !VA_COPY */ ]) ]) Index: src/FileAccess.cc =================================================================== RCS file: /home/lav/cvsroot/lftp/src/FileAccess.cc,v retrieving revision 1.88 diff -u -r1.88 FileAccess.cc --- src/FileAccess.cc 2001/11/30 16:23:03 1.88 +++ src/FileAccess.cc 2001/12/05 00:22:03 @@ -33,9 +33,6 @@ #include <errno.h> #include "ascii_ctype.h" #include <fcntl.h> -/* Our autoconf test will switch to lib/fnmatch.c if the local fnmatch - * isn't GNU, so this should be OK. */ -#define _GNU_SOURCE #include <fnmatch.h> #include "LsCache.h" #include "xalloca.h" Index: src/FileSetOutput.cc =================================================================== RCS file: /home/lav/cvsroot/lftp/src/FileSetOutput.cc,v retrieving revision 1.16 diff -u -r1.16 FileSetOutput.cc --- src/FileSetOutput.cc 2001/12/04 10:40:04 1.16 +++ src/FileSetOutput.cc 2001/12/05 00:22:04 @@ -32,7 +32,7 @@ #include <sys/stat.h> #include <assert.h> #include <locale.h> - +#include <fnmatch.h> #include <mbswidth.h> CDECL_BEGIN @@ -42,11 +42,6 @@ #include "misc.h" #include "ResMgr.h" -/* Our autoconf test will switch to lib/fnmatch.c if the local fnmatch - * isn't GNU, so this should be OK. */ -#define _GNU_SOURCE -#include <fnmatch.h> - #include "FileSetOutput.h" #include "ArgV.h" #include "ColumnOutput.h" @@ -353,3 +348,17 @@ { return session->CurrentStatus(); } + +void FileCopyPeerCLS::Suspend() +{ + if(session) + session->Suspend(); + super::Suspend(); +} +void FileCopyPeerCLS::Resume() +{ + super::Resume(); + if(session) + session->Resume(); +} + Index: src/FileSetOutput.h =================================================================== RCS file: /home/lav/cvsroot/lftp/src/FileSetOutput.h,v retrieving revision 1.8 diff -u -r1.8 FileSetOutput.h --- src/FileSetOutput.h 2001/11/19 15:15:59 1.8 +++ src/FileSetOutput.h 2001/12/05 00:22:04 @@ -81,8 +81,12 @@ FileCopyPeerCLS(FA *s, ArgV *a, const FileSetOutput &_opts); int Do(); const char *GetStatus(); - void Quiet() { quiet = 1; } -}; + void Quiet() { quiet = true; } + void Fg() { session->SetPriority(1); } + void Bg() { session->SetPriority(0); } + void Suspend(); + void Resume(); +}; #endif Index: src/QueueFeeder.cc =================================================================== RCS file: /home/lav/cvsroot/lftp/src/QueueFeeder.cc,v retrieving revision 1.2 diff -u -r1.2 QueueFeeder.cc --- src/QueueFeeder.cc 2001/10/03 08:13:38 1.2 +++ src/QueueFeeder.cc 2001/12/05 00:22:06 @@ -24,10 +24,6 @@ #include <errno.h> #include <unistd.h> #include <assert.h> - -/* Our autoconf test will switch to lib/fnmatch.c if the local fnmatch - * isn't GNU, so this should be OK. */ -#define _GNU_SOURCE #include <fnmatch.h> #include "QueueFeeder.h"