File 0005-Add-the-wrapper-code-to-the-Makefile-in-order-to-bui.patch of Package lftp
From 6abce26def9e39e0fe3f5cd05660768d2505300b Mon Sep 17 00:00:00 2001
From: =?utf8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= <tomas.chvatal@gmail.com>
Date: Wed, 28 Feb 2018 19:11:37 +0100
Subject: [PATCH 5/5] Add the wrapper code to the Makefile in order to build
---
src/CmdExec.cc | 32 ++++++++++++++++++++++++++++++++
src/CmdExec.h | 3 +++
src/CopyJob.cc | 3 ++-
src/Makefile.am | 12 ++++++++++--
4 files changed, 47 insertions(+), 3 deletions(-)
Index: lftp-4.9.2/src/CmdExec.cc
===================================================================
--- lftp-4.9.2.orig/src/CmdExec.cc 2017-08-10 09:58:38.000000000 +0000
+++ lftp-4.9.2/src/CmdExec.cc 2023-07-26 15:02:36.660734739 +0000
@@ -1234,6 +1234,38 @@ void CmdExec::ChangeSession(FileAccess *
ConnectionSlot::Set(slot,session);
}
+void CmdExec::RegisterCompatCommand(const char *name,cmd_creator_t creator,const char *short_desc,const char *long_desc)
+{
+ if(dyn_cmd_table==0)
+ {
+ int count=0;
+ for(const cmd_rec *c=static_cmd_table; c->name; c++)
+ count++;
+ dyn_cmd_table.nset(static_cmd_table,count);
+ }
+ for(int i=0; i<dyn_cmd_table.count(); i++)
+ {
+ cmd_rec *const c=&dyn_cmd_table[i];
+ if(!strcmp(c->name,name))
+ {
+ char *lftp_name=(char*)malloc(5+strlen(name)+1);
+ char *short_d = NULL;
+
+ if (c->short_desc) {
+ short_d = (char*)malloc(5+strlen(c->short_desc)+1);
+ sprintf(short_d, "lftp-%s", c->short_desc);
+ c->short_desc = short_d;
+ }
+
+ sprintf(lftp_name, "lftp-%s", name);
+ c->name = lftp_name;
+ break;
+ }
+ }
+ cmd_rec new_entry={name,creator,short_desc,long_desc};
+ dyn_cmd_table.append(new_entry);
+}
+
const char *CmdExec::CmdByIndex(int i)
{
if(dyn_cmd_table)
Index: lftp-4.9.2/src/CmdExec.h
===================================================================
--- lftp-4.9.2.orig/src/CmdExec.h 2017-09-20 11:09:57.000000000 +0000
+++ lftp-4.9.2/src/CmdExec.h 2023-07-26 15:02:36.660734739 +0000
@@ -238,6 +238,9 @@ public:
static void RegisterCommand(const char *name,cmd_creator_t creator,
const char *short_name=0,const char *long_name=0);
+ static void RegisterCompatCommand(const char *name,cmd_creator_t creator,
+ const char *short_name=0,const char *long_name=0);
+
Job *builtin_lcd();
Job *builtin_cd();
Job *builtin_open();
Index: lftp-4.9.2/src/CopyJob.cc
===================================================================
--- lftp-4.9.2.orig/src/CopyJob.cc 2020-06-04 20:13:58.000000000 +0000
+++ lftp-4.9.2/src/CopyJob.cc 2023-07-26 15:02:36.660734739 +0000
@@ -18,6 +18,7 @@
*/
#include <config.h>
+#include <unistd.h>
#include "CopyJob.h"
#include "ArgV.h"
#include "plural.h"
@@ -271,7 +272,7 @@ void CopyJobEnv::SetCopier(FileCopy *c,c
xstring& CopyJobEnv::FormatFinalWithPrefix(xstring& s,const char *p)
{
- if(no_status)
+ if(no_status || !isatty(1))
return s;
if(count==errors)
return s;
Index: lftp-4.9.2/src/Makefile.am
===================================================================
--- lftp-4.9.2.orig/src/Makefile.am 2019-03-22 19:26:54.000000000 +0000
+++ lftp-4.9.2/src/Makefile.am 2023-07-26 15:05:12.613750066 +0000
@@ -10,7 +10,7 @@ EXTRA_DIST = $(pkgdata_SCRIPTS) $(bin_SC
lftp_SOURCES = lftp.cc complete.h complete.cc lftp_rl.c lftp_rl.h attach.cc attach.h
TASK_MODULES = liblftp-pty.la liblftp-network.la proto-ftp.la proto-http.la proto-file.la proto-fish.la proto-sftp.la
-JOB_MODULES = cmd-mirror.la cmd-sleep.la cmd-torrent.la
+JOB_MODULES = cmd-mirror.la cmd-sleep.la cmd-torrent.la cmd-edit.la compat-mode.la
if WITH_MODULES
pkgverlib_LTLIBRARIES = $(TASK_MODULES) $(JOB_MODULES)
else
@@ -30,6 +30,8 @@ cmd_mirror_la_SOURCES = MirrorJob.cc Mir
cmd_sleep_la_SOURCES = SleepJob.cc SleepJob.h
cmd_torrent_la_SOURCES= Torrent.cc Torrent.h TorrentTracker.cc TorrentTracker.h\
DHT.cc DHT.h Bencode.cc Bencode.h
+cmd_edit_la_SOURCES = cmd-edit.cc
+compat_mode_la_SOURCES= CompatMode.cc CompatMode.h
liblftp_pty_la_SOURCES = PtyShell.cc PtyShell.h lftp_pty.c lftp_pty.h SSH_Access.cc SSH_Access.h
liblftp_network_la_SOURCES = NetAccess.cc NetAccess.h Resolver.cc Resolver.h\
lftp_ssl.cc lftp_ssl.h buffer_ssl.cc buffer_ssl.h RateLimit.cc RateLimit.h\
@@ -49,6 +51,8 @@ proto_sftp_la_LDFLAGS = -module -avoid-v
cmd_mirror_la_LDFLAGS = -module -avoid-version -rpath $(pkgverlibdir)
cmd_sleep_la_LDFLAGS = -module -avoid-version -rpath $(pkgverlibdir)
cmd_torrent_la_LDFLAGS= -module -avoid-version -rpath $(pkgverlibdir)
+cmd_edit_la_LDFLAGS = -module -avoid-version -rpath $(pkgverlibdir)
+compat_mode_la_LDFLAGS = -module -avoid-version -rpath $(pkgverlibdir)
liblftp_pty_la_LDFLAGS = -avoid-version -rpath $(pkgverlibdir)
liblftp_network_la_CPPFLAGS = $(AM_CPPFLAGS) $(OPENSSL_CPPFLAGS) $(ZLIB_CPPFLAGS) $(LIBGNUTLS_CFLAGS)
liblftp_network_la_LDFLAGS = -avoid-version -rpath $(pkgverlibdir)