Skip to content

Instantly share code, notes, and snippets.

@nijikon
Created June 13, 2016 14:13
Show Gist options
  • Save nijikon/b1b4eb47c39cd171b9fa4c892d6ca2ff to your computer and use it in GitHub Desktop.
Save nijikon/b1b4eb47c39cd171b9fa4c892d6ca2ff to your computer and use it in GitHub Desktop.
diff -aur a/src/Makefile.am b/src/Makefile.am
--- a/src/Makefile.am 2016-06-13 16:06:28.000000000 +0200
+++ b/src/Makefile.am 2016-06-13 16:06:41.000000000 +0200
@@ -7,7 +7,7 @@
EXTRA_DIST = $(pkgdata_SCRIPTS) $(bin_SCRIPTS) $(noinst_SCRIPTS)
-lftp_SOURCES = lftp.cc complete.h complete.cc lftp_rl.c lftp_rl.h attach.cc attach.h
+lftp_SOURCES = lftp.cc complete.h complete.cc lftp_rl.cc 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
diff -aur a/src/complete.cc b/src/complete.cc
--- a/src/complete.cc 2016-06-13 16:06:28.000000000 +0200
+++ b/src/complete.cc 2016-06-13 16:06:41.000000000 +0200
@@ -857,7 +857,7 @@
return matches;
}
-extern "C" void lftp_line_complete()
+void lftp_line_complete()
{
delete glob_res;
glob_res=0;
@@ -1286,7 +1286,7 @@
}
}
-extern "C" void completion_display_list (char **matches, int len)
+void completion_display_list (char **matches, int len)
{
JobRef<OutputJob> b(new OutputJob((FDStream *) NULL, "completion"));
diff -aur a/src/complete.h b/src/complete.h
--- a/src/complete.h 2016-06-13 16:06:28.000000000 +0200
+++ b/src/complete.h 2016-06-13 16:06:41.000000000 +0200
@@ -26,6 +26,7 @@
extern CmdExec *completion_shell;
extern int remote_completion;
int lftp_rl_getc(FILE *);
-extern "C" void lftp_line_complete();
+void lftp_line_complete();
+void completion_display_list (char **matches, int len);
#endif //COMPLETE_H
diff -aur a/src/lftp_rl.c b/src/lftp_rl.c
--- a/src/lftp_rl.c 2016-06-13 16:06:28.000000000 +0200
+++ b/src/lftp_rl.c 2016-06-13 16:06:53.000000000 +0200
@@ -19,14 +19,13 @@
#include <config.h>
#include <stdio.h>
-#include <readline.h>
-#include <history.h>
+#include <readline/readline.h>
+#include <readline/history.h>
#include <stdlib.h>
#include <string.h>
#include "lftp_rl.h"
-
-/* complete.cc */
-void lftp_line_complete();
+#include "misc.h"
+#include "complete.h"
void lftp_add_history_nodups(const char *cmd_buf)
{
@@ -142,8 +141,6 @@
return rl_completion_matches(text,compentry);
}
-void completion_display_list (char **matches, int len);
-
void lftp_rl_display_match_list (char **matches, int len, int max)
{
printf("\n"); /* get off the input line */
@@ -184,7 +181,7 @@
}
void lftp_rl_bind(const char *key,const char *func)
{
- char *line=alloca(strlen(key)+2+strlen(func)+1);
+ char *line=(char*)alloca(strlen(key)+2+strlen(func)+1);
sprintf(line,"%s: %s",key,func);
rl_parse_and_bind(line);
}
@@ -194,8 +191,6 @@
rl_set_prompt(p);
}
-extern char *get_lftp_data_dir();
-
static char *lftp_history_file;
void lftp_rl_read_history()
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment