Switch from newsbeuter to newsboat

This commit is contained in:
Fredrik Fornwall 2017-10-15 00:36:54 +02:00
parent 9f74bac671
commit 8f7c38020d
14 changed files with 78 additions and 474 deletions

View File

@ -1,14 +0,0 @@
diff -Naur newsbeuter.orig/config.sh newsbeuter/config.sh
--- newsbeuter.orig/config.sh 2016-11-13 11:12:30.735183059 +0100
+++ newsbeuter/config.sh 2016-11-13 11:20:14.820017266 +0100
@@ -107,10 +107,5 @@
check_pkg "stfl" || fail "stfl"
( check_pkg "json" "" 0.11 || check_pkg "json-c" "" 0.11 ) || fail "json-c"
-if [ `uname -s` = "Darwin" ]; then
- check_custom "ncurses5.4" "ncurses5.4-config" || fail "ncurses5.4"
-elif [ `uname -s` != "OpenBSD" ]; then
- check_custom "ncursesw5" "ncursesw5-config" || fail "ncursesw"
-fi
check_ssl_implementation
all_aboard_the_fail_boat

View File

@ -1,90 +0,0 @@
diff -Naur newsbeuter-2.9.orig/src/controller.cpp newsbeuter-2.9/src/controller.cpp
--- newsbeuter-2.9.orig/src/controller.cpp 2015-02-19 11:56:59.000000000 +0100
+++ newsbeuter-2.9/src/controller.cpp 2016-05-30 07:22:44.205246118 +0200
@@ -35,7 +35,11 @@
#include <signal.h>
#include <unistd.h>
#include <sys/utsname.h>
+#ifdef __ANDROID__
+#define nl_langinfo(x) "UTF-8"
+#else
#include <langinfo.h>
+#endif
#include <libgen.h>
#include <sys/types.h>
diff -Naur newsbeuter-2.9.orig/src/feedlist_formaction.cpp newsbeuter-2.9/src/feedlist_formaction.cpp
--- newsbeuter-2.9.orig/src/feedlist_formaction.cpp 2015-02-19 11:56:59.000000000 +0100
+++ newsbeuter-2.9/src/feedlist_formaction.cpp 2016-05-30 07:23:49.126683313 +0200
@@ -16,7 +16,11 @@
#include <cstring>
+#ifdef __ANDROID__
+#define nl_langinfo(x) "UTF-8"
+#else
#include <langinfo.h>
+#endif
#define FILTER_UNREAD_FEEDS "unread_count != \"0\""
diff -Naur newsbeuter-2.9.orig/src/itemlist_formaction.cpp newsbeuter-2.9/src/itemlist_formaction.cpp
--- newsbeuter-2.9.orig/src/itemlist_formaction.cpp 2015-02-19 11:56:59.000000000 +0100
+++ newsbeuter-2.9/src/itemlist_formaction.cpp 2016-05-30 07:24:48.211991329 +0200
@@ -11,7 +11,11 @@
#include <cassert>
#include <sstream>
+#ifdef __ANDROID__
+#define nl_langinfo(x) "UTF-8"
+#else
#include <langinfo.h>
+#endif
#define FILTER_UNREAD_ITEMS "unread != \"no\""
diff -Naur newsbeuter-2.9.orig/src/rss.cpp newsbeuter-2.9/src/rss.cpp
--- newsbeuter-2.9.orig/src/rss.cpp 2015-02-19 11:56:59.000000000 +0100
+++ newsbeuter-2.9/src/rss.cpp 2016-05-30 07:25:47.473303219 +0200
@@ -14,7 +14,11 @@
#include <sys/utsname.h>
#include <htmlrenderer.h>
+#ifdef __ANDROID__
+#define nl_langinfo(x) "UTF-8"
+#else
#include <langinfo.h>
+#endif
#include <cerrno>
diff -Naur newsbeuter-2.9.orig/src/stflpp.cpp newsbeuter-2.9/src/stflpp.cpp
--- newsbeuter-2.9.orig/src/stflpp.cpp 2015-02-19 11:56:59.000000000 +0100
+++ newsbeuter-2.9/src/stflpp.cpp 2016-05-30 07:23:16.721965956 +0200
@@ -3,7 +3,11 @@
#include <exception.h>
#include <cerrno>
+#ifdef __ANDROID__
+#define nl_langinfo(x) "UTF-8"
+#else
#include <langinfo.h>
+#endif
namespace newsbeuter {
diff -Naur newsbeuter-2.9.orig/src/utils.cpp newsbeuter-2.9/src/utils.cpp
--- newsbeuter-2.9.orig/src/utils.cpp 2015-02-19 11:56:59.000000000 +0100
+++ newsbeuter-2.9/src/utils.cpp 2016-05-30 07:26:15.429922120 +0200
@@ -21,7 +21,11 @@
#include <curl/curl.h>
+#ifdef __ANDROID__
+#define nl_langinfo(x) "UTF-8"
+#else
#include <langinfo.h>
+#endif
#include <stfl.h>
#include <libxml/uri.h>

View File

@ -1,75 +0,0 @@
diff -Naur newsbeuter-2.9.orig/src/feedhq_api.cpp newsbeuter-2.9/src/feedhq_api.cpp
--- newsbeuter-2.9.orig/src/feedhq_api.cpp 2015-02-19 11:56:59.000000000 +0100
+++ newsbeuter-2.9/src/feedhq_api.cpp 2016-05-30 20:56:34.814136288 +0200
@@ -23,6 +23,21 @@
#define FEEDHQ_API_EDIT_TAG_URL FEEDHQ_API_PREFIX "edit-tag"
#define FEEDHQ_API_TOKEN_URL FEEDHQ_API_PREFIX "token"
+#ifdef __ANDROID__
+static char* getpass(const char* prompt) {
+ static char chars[128];
+ int len = 0;
+ while (1) {
+ char c = fgetc(stdin);
+ if (c == '\r' || c == '\n' || c == 0) break;
+ chars[len++] = c;
+ if (len == sizeof(chars)-1) break;
+ }
+ chars[len] = 0;
+ return chars;
+}
+#endif
+
namespace newsbeuter {
feedhq_api::feedhq_api(configcontainer * c) : remote_api(c) {
diff -Naur newsbeuter-2.9.orig/src/oldreader_api.cpp newsbeuter-2.9/src/oldreader_api.cpp
--- newsbeuter-2.9.orig/src/oldreader_api.cpp 2015-02-19 11:56:59.000000000 +0100
+++ newsbeuter-2.9/src/oldreader_api.cpp 2016-05-30 20:52:47.955828120 +0200
@@ -25,6 +25,21 @@
// for reference, see https://github.com/theoldreader/api
+#ifdef __ANDROID__
+static char* getpass(const char* prompt) {
+ static char chars[128];
+ int len = 0;
+ while (1) {
+ char c = fgetc(stdin);
+ if (c == '\r' || c == '\n' || c == 0) break;
+ chars[len++] = c;
+ if (len == sizeof(chars)-1) break;
+ }
+ chars[len] = 0;
+ return chars;
+}
+#endif
+
namespace newsbeuter {
oldreader_api::oldreader_api(configcontainer * c) : remote_api(c) {
diff -Naur newsbeuter-2.9.orig/src/ttrss_api.cpp newsbeuter-2.9/src/ttrss_api.cpp
--- newsbeuter-2.9.orig/src/ttrss_api.cpp 2015-02-19 11:56:59.000000000 +0100
+++ newsbeuter-2.9/src/ttrss_api.cpp 2016-05-30 20:46:00.368865179 +0200
@@ -10,6 +10,21 @@
#include <markreadthread.h>
+#ifdef __ANDROID__
+static char* getpass(const char* prompt) {
+ static char chars[128];
+ int len = 0;
+ while (1) {
+ char c = fgetc(stdin);
+ if (c == '\r' || c == '\n' || c == 0) break;
+ chars[len++] = c;
+ if (len == sizeof(chars)-1) break;
+ }
+ chars[len] = 0;
+ return chars;
+}
+#endif
+
namespace newsbeuter {
ttrss_api::ttrss_api(configcontainer * c) : remote_api(c) {

View File

@ -1,30 +0,0 @@
diff -Naur newsbeuter-2.9.orig/Makefile newsbeuter-2.9/Makefile
--- newsbeuter-2.9.orig/Makefile 2015-02-19 11:56:59.000000000 +0100
+++ newsbeuter-2.9/Makefile 2016-05-30 22:19:09.524310908 +0200
@@ -35,7 +35,7 @@
NEWSBEUTER=newsbeuter
NEWSBEUTER_SOURCES:=$(shell cat mk/newsbeuter.deps)
NEWSBEUTER_OBJS:=$(patsubst %.cpp,%.o,$(NEWSBEUTER_SOURCES))
-NEWSBEUTER_LIBS=-lbeuter -lfilter -lpthread -lrsspp
+NEWSBEUTER_LIBS=-lbeuter -lfilter -lrsspp -lncursesw
RSSPPLIB_SOURCES=$(wildcard rss/*.cpp)
RSSPPLIB_OBJS=$(patsubst rss/%.cpp,rss/%.o,$(RSSPPLIB_SOURCES))
@@ -45,7 +45,7 @@
PODBEUTER=podbeuter
PODBEUTER_SOURCES:=$(shell cat mk/podbeuter.deps)
PODBEUTER_OBJS:=$(patsubst %.cpp,%.o,$(PODBEUTER_SOURCES))
-PODBEUTER_LIBS=-lbeuter -lpthread
+PODBEUTER_LIBS=-lbeuter
ifeq (, $(filter Linux GNU GNU/%, $(shell uname -s)))
NEWSBEUTER_LIBS+=-liconv -lintl
@@ -57,8 +57,6 @@
INSTALL=install
A2X=a2x
MSGFMT=msgfmt
-RANLIB=ranlib
-AR=ar
STFLHDRS:=$(patsubst %.stfl,%.h,$(wildcard stfl/*.stfl))
POFILES:=$(wildcard po/*.po)

View File

@ -1,41 +0,0 @@
diff -Naur newsbeuter-2.9.orig/src/stflpp.cpp newsbeuter-2.9/src/stflpp.cpp
--- newsbeuter-2.9.orig/src/stflpp.cpp 2015-02-19 11:56:59.000000000 +0100
+++ newsbeuter-2.9/src/stflpp.cpp 2016-06-02 23:38:15.880195527 +0200
@@ -16,7 +20,7 @@
*/
stfl::form::form(const std::string& text) : f(0) {
- ipool = stfl_ipool_create((std::string(nl_langinfo(CODESET)) + "//TRANSLIT").c_str());
+ ipool = stfl_ipool_create(std::string(nl_langinfo(CODESET)).c_str());
if (!ipool) {
throw exception(errno);
}
@@ -82,7 +86,7 @@
std::string stfl::quote(const std::string& text) {
std::lock_guard<std::mutex> lock(quote_mtx);
- stfl_ipool * ipool = stfl_ipool_create((std::string(nl_langinfo(CODESET)) + "//TRANSLIT").c_str());
+ stfl_ipool * ipool = stfl_ipool_create(std::string(nl_langinfo(CODESET)).c_str());
std::string retval = stfl_ipool_fromwc(ipool,stfl_quote(stfl_ipool_towc(ipool,text.c_str())));
stfl_ipool_destroy(ipool);
return retval;
diff -Naur newsbeuter-2.9.orig/src/utils.cpp newsbeuter-2.9/src/utils.cpp
--- newsbeuter-2.9.orig/src/utils.cpp 2015-02-19 11:56:59.000000000 +0100
+++ newsbeuter-2.9/src/utils.cpp 2016-06-02 23:38:38.648892251 +0200
@@ -262,7 +272,7 @@
if (strcasecmp(tocode.c_str(), fromcode.c_str())==0)
return text;
- iconv_t cd = ::iconv_open((tocode + "//TRANSLIT").c_str(), fromcode.c_str());
+ iconv_t cd = ::iconv_open(tocode.c_str(), fromcode.c_str());
if (cd == reinterpret_cast<iconv_t>(-1))
return result;
@@ -498,7 +508,6 @@
std::string utils::wstr2str(const std::wstring& wstr) {
std::string codeset = nl_langinfo(CODESET);
- codeset.append("//TRANSLIT");
struct stfl_ipool * ipool = stfl_ipool_create(codeset.c_str());
std::string result = stfl_ipool_fromwc(ipool, wstr.c_str());
stfl_ipool_destroy(ipool);

View File

@ -1,37 +0,0 @@
From 931e9aec73f94b5c6e70bcb9f0c857827650ec30 Mon Sep 17 00:00:00 2001
From: Simon Nagl <simonnagl@aim.com>
Date: Thu, 7 May 2015 22:06:00 +0200
Subject: [PATCH 1/1] Bugfix: #180 Fixed cleanup_cache for one line config file
Fixed the generation of the string list.
First with only one url in file urls list looked like this:
('www.feed.com/rss''') which does not lead to a working SQL statement.
Now, lists do always end with ', '')
---
src/cache.cpp | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/src/cache.cpp b/src/cache.cpp
index ae2c98f..4376d10 100644
--- a/src/cache.cpp
+++ b/src/cache.cpp
@@ -555,15 +555,11 @@ void cache::cleanup_cache(std::vector<std::shared_ptr<rss_feed>>& feeds) {
LOG(LOG_DEBUG,"cache::cleanup_cache: cleaning up cache...");
std::string list = "(";
int rc;
- unsigned int i = 0;
- unsigned int feed_size = feeds.size();
for (auto feed : feeds) {
std::string name = prepare_query("'%q'",feed->rssurl().c_str());
list.append(name);
- if (i < feed_size-1) {
- list.append(", ");
- }
+ list.append(", ");
}
list.append("'')");
--
2.7.4 (Apple Git-66)

View File

@ -1,92 +0,0 @@
From e11b656bda59ca31b4f9ab4c5a14696813b0f6f4 Mon Sep 17 00:00:00 2001
From: Tilman Keskinoz <arved@FreeBSD.org>
Date: Thu, 12 Mar 2015 11:03:50 +0100
Subject: [PATCH 1/3] Detach thread, to avoid thread being destructed when it
is going out of scope
---
src/pb_controller.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/pb_controller.cpp b/src/pb_controller.cpp
index 09b5e89..da8ffcb 100644
--- a/src/pb_controller.cpp
+++ b/src/pb_controller.cpp
@@ -287,6 +287,7 @@ void pb_controller::start_downloads() {
if (it->status() == DL_QUEUED) {
std::thread t {poddlthread(&(*it), cfg)};
--dl2start;
+ t.detach();
}
}
}
From f79e5527ba5f54677540637f5b8d287215cfa051 Mon Sep 17 00:00:00 2001
From: Tilman Keskinoz <arved@FreeBSD.org>
Date: Thu, 12 Mar 2015 11:04:49 +0100
Subject: [PATCH 2/3] Fix segfault
I think somewhere the poddlthread is copied and the memory messed up.
Make it a shared_ptr to fix segfault.
Why is this a pointer anyway?
---
include/poddlthread.h | 3 ++-
src/poddlthread.cpp | 1 -
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/poddlthread.h b/include/poddlthread.h
index a10b9e7..cf0f1da 100644
--- a/include/poddlthread.h
+++ b/include/poddlthread.h
@@ -7,6 +7,7 @@
#include <sys/time.h>
#include <time.h>
+#include <memory>
#include <configcontainer.h>
@@ -24,7 +25,7 @@ class poddlthread {
private:
void mkdir_p(const char * file);
download * dl;
- std::ofstream *f;
+ std::shared_ptr<std::ofstream> f;
timeval tv1;
timeval tv2;
size_t bytecount;
diff --git a/src/poddlthread.cpp b/src/poddlthread.cpp
index 583481e..3a1b390 100644
--- a/src/poddlthread.cpp
+++ b/src/poddlthread.cpp
@@ -22,7 +22,6 @@ poddlthread::poddlthread(download * dl_, newsbeuter::configcontainer * c) : dl(d
}
poddlthread::~poddlthread() {
- delete f;
}
void poddlthread::operator()() {
From 49dbf84d9500860c48c1d3137cf0d7ab89588726 Mon Sep 17 00:00:00 2001
From: Tilman Keskinoz <arved@FreeBSD.org>
Date: Thu, 12 Mar 2015 11:30:24 +0100
Subject: [PATCH 3/3] Another threa.detach() missing
---
src/pb_view.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/pb_view.cpp b/src/pb_view.cpp
index fb61c72..f3cb478 100644
--- a/src/pb_view.cpp
+++ b/src/pb_view.cpp
@@ -111,6 +111,7 @@ void pb_view::run(bool auto_download) {
if (idx != -1) {
if (ctrl->downloads()[idx].status() != DL_DOWNLOADING) {
std::thread t {poddlthread(&ctrl->downloads()[idx], ctrl->get_cfgcont())};
+ t.detach();
}
}
}

View File

@ -1,71 +0,0 @@
From c841c4a7871d2f79f9b7e2d53734f55e8410e231 Mon Sep 17 00:00:00 2001
From: Alexander Batischev <eual.jp@gmail.com>
Date: Fri, 22 Jan 2016 22:55:48 +0300
Subject: [PATCH] Re-download, not delete, existing files. Fixes #169
---
include/poddlthread.h | 1 +
src/poddlthread.cpp | 19 +++++++++++++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/include/poddlthread.h b/include/poddlthread.h
index cf0f1da..99299f3 100644
--- a/include/poddlthread.h
+++ b/include/poddlthread.h
@@ -23,6 +23,7 @@ class poddlthread {
protected:
double compute_kbps();
private:
+ void run();
void mkdir_p(const char * file);
download * dl;
std::shared_ptr<std::ofstream> f;
diff --git a/src/poddlthread.cpp b/src/poddlthread.cpp
index 3a1b390..afa6762 100644
--- a/src/poddlthread.cpp
+++ b/src/poddlthread.cpp
@@ -25,6 +25,13 @@ poddlthread::~poddlthread() {
}
void poddlthread::operator()() {
+ run();
+}
+
+void poddlthread::run() {
+ // are we resuming previous download?
+ bool resumed_download = false;
+
gettimeofday(&tv1, NULL);
++bytecount;
@@ -55,11 +62,13 @@ void poddlthread::operator()() {
mkdir_p(dl->filename());
f->open(dl->filename(), std::fstream::out);
dl->set_offset(0);
+ resumed_download = false;
} else {
LOG(LOG_INFO, "poddlthread::run: stat ok: starting download from %u", sb.st_size);
curl_easy_setopt(easyhandle, CURLOPT_RESUME_FROM, sb.st_size);
dl->set_offset(sb.st_size);
f->open(dl->filename(), std::fstream::out | std::fstream::app);
+ resumed_download = true;
}
if (f->is_open()) {
@@ -75,8 +84,14 @@ void poddlthread::operator()() {
if (0 == success)
dl->set_status(DL_READY);
else if (dl->status() != DL_CANCELLED) {
- dl->set_status(DL_FAILED);
- ::unlink(dl->filename());
+ // attempt complete re-download
+ if (resumed_download) {
+ ::unlink(dl->filename());
+ this->run();
+ } else {
+ dl->set_status(DL_FAILED);
+ ::unlink(dl->filename());
+ }
}
} else {
dl->set_status(DL_FAILED);

View File

@ -1,23 +0,0 @@
TERMUX_PKG_HOMEPAGE=http://www.newsbeuter.org
TERMUX_PKG_DESCRIPTION="An open-source RSS/Atom feed reader for text terminals"
TERMUX_PKG_VERSION=2.9
TERMUX_PKG_REVISION=2
TERMUX_PKG_SRCURL=http://www.newsbeuter.org/downloads/newsbeuter-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=74a8bf019b09c3b270ba95adc29f2bbe48ea1f55cc0634276b21fcce1f043dc8
TERMUX_PKG_DEPENDS="libandroid-support, json-c, libsqlite, libcurl, libxml2, stfl, ncurses, openssl"
TERMUX_PKG_BUILD_IN_SRC=yes
TERMUX_PKG_RM_AFTER_INSTALL="share/locale"
termux_step_pre_configure () {
# Put a temporary link for libtinfo.so
ln -s -f $TERMUX_PREFIX/lib/libncursesw.so $TERMUX_PREFIX/lib/libtinfo.so
}
termux_step_configure () {
# nwesbeuter doesn't contain configure script
return
}
termux_step_post_make_install () {
rm $TERMUX_PREFIX/lib/libtinfo.so
}

View File

@ -7,7 +7,7 @@ diff -u -r ../newsbeuter-2.9/src/utils.cpp ./src/utils.cpp
+#ifdef __ANDROID__
+#include <sys/file.h>
+inline int lockf(int fd, int cmd, off_t ignored_len) {
+inline int lockf(int fd, int cmd, off_t) {
+ return flock(fd, cmd);
+}
+#endif

View File

@ -0,0 +1,41 @@
diff -u -r ../newsboat-2.10.1/Makefile ./Makefile
--- ../newsboat-2.10.1/Makefile 2017-09-22 22:01:50.000000000 +0200
+++ ./Makefile 2017-10-15 00:21:33.616133145 +0200
@@ -21,7 +21,7 @@
WARNFLAGS=-Werror -Wall -Wextra -Wunreachable-code
INCLUDES=-Iinclude -Istfl -Ifilter -I. -Irss
BARE_CXXFLAGS=-std=c++11 -ggdb $(INCLUDES)
-CXXFLAGS+=$(BARE_CXXFLAGS) $(WARNFLAGS) $(DEFINES)
+CXXFLAGS+=$(BARE_CXXFLAGS) $(WARNFLAGS) $(DEFINES) $(CPPFLAGS) -Wno-error=sign-compare -Wno-error=unused-lambda-capture
LDFLAGS+=-L. -fprofile-arcs -ftest-coverage
PACKAGE=newsboat
@@ -45,7 +45,7 @@
NEWSBEUTER=newsboat
NEWSBEUTER_SOURCES:=$(shell cat mk/newsbeuter.deps)
NEWSBEUTER_OBJS:=$(patsubst %.cpp,%.o,$(NEWSBEUTER_SOURCES))
-NEWSBEUTER_LIBS=-lbeuter -lfilter -lpthread -lrsspp
+NEWSBEUTER_LIBS=-lbeuter -lfilter -lrsspp -landroid-glob
RSSPPLIB_SOURCES=$(sort $(wildcard rss/*.cpp))
RSSPPLIB_OBJS=$(patsubst rss/%.cpp,rss/%.o,$(RSSPPLIB_SOURCES))
@@ -55,7 +55,7 @@
PODBEUTER=podboat
PODBEUTER_SOURCES:=$(shell cat mk/podbeuter.deps)
PODBEUTER_OBJS:=$(patsubst %.cpp,%.o,$(PODBEUTER_SOURCES))
-PODBEUTER_LIBS=-lbeuter -lpthread
+PODBEUTER_LIBS=-lbeuter
ifeq (, $(filter Linux GNU GNU/%, $(shell uname -s)))
NEWSBEUTER_LIBS+=-liconv -lintl
@@ -67,8 +67,8 @@
INSTALL=install
A2X=a2x
MSGFMT=msgfmt
-RANLIB=ranlib
-AR=ar
+RANLIB?=ranlib
+AR?=ar
CHMOD=chmod
STFLHDRS:=$(patsubst %.stfl,%.h,$(wildcard stfl/*.stfl))

View File

@ -0,0 +1,10 @@
TERMUX_PKG_HOMEPAGE=https://newsboat.org/
TERMUX_PKG_DESCRIPTION="RSS/Atom feed reader for the text console"
TERMUX_PKG_VERSION=2.10.1
TERMUX_PKG_SRCURL=https://newsboat.org/releases/${TERMUX_PKG_VERSION}/newsboat-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=44d698284246ad82e32fa7cb7f07086fa1ef8406baab09d33321e1252f9cf8f5
TERMUX_PKG_DEPENDS="libandroid-support, libandroid-glob, json-c, libsqlite, libcurl, libxml2, stfl, ncurses, openssl"
TERMUX_PKG_BUILD_IN_SRC=yes
TERMUX_PKG_RM_AFTER_INSTALL="share/locale"
TERMUX_PKG_CONFLICTS=newsbeuter
TERMUX_PKG_REPLACES=newsbeuter

View File

@ -0,0 +1,26 @@
diff -u -r ../newsboat-2.10.1/src/remote_api.cpp ./src/remote_api.cpp
--- ../newsboat-2.10.1/src/remote_api.cpp 2017-09-22 22:01:50.000000000 +0200
+++ ./src/remote_api.cpp 2017-10-15 00:14:41.848769212 +0200
@@ -36,6 +36,22 @@
return pass;
}
+#ifdef __ANDROID__
+static char* getpass(const char* prompt) {
+ printf("%s\n", prompt);
+ static char chars[128];
+ int len = 0;
+ while (1) {
+ char c = fgetc(stdin);
+ if (c == '\r' || c == '\n' || c == 0) break;
+ chars[len++] = c;
+ if (len == sizeof(chars)-1) break;
+ }
+ chars[len] = 0;
+ return chars;
+}
+#endif
+
credentials remote_api::get_credentials(const std::string& scope, const std::string& name) {
std::string user = cfg->get_configvalue(scope+"-login");
std::string pass = cfg->get_configvalue(scope+"-password");