ctorrent: import from packages

Signed-off-by: Peter Wagner <tripolar@gmx.at>
This commit is contained in:
Peter Wagner
2014-06-16 11:38:45 +02:00
parent a1c86a0a84
commit 2ed81adda6
6 changed files with 660 additions and 0 deletions
+97
View File
@@ -0,0 +1,97 @@
#
# Copyright (C) 2006-2008 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=ctorrent-svn
PKG_REV:=322
PKG_VERSION:=r$(PKG_REV)
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://dtorrent.svn.sourceforge.net/svnroot/dtorrent/dtorrent/trunk
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=$(PKG_REV)
PKG_SOURCE_PROTO:=svn
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
define Package/ctorrent-svn/Default
SUBMENU:=BitTorrent
SECTION:=net
CATEGORY:=Network
DEPENDS:=+uclibcxx
TITLE:=console-based BitTorrent client
MAINTAINER:=Peter Wagner <tripolar@gmx.at>
URL:=http://www.rahul.net/dholmes/ctorrent/
endef
define Package/ctorrent-svn/Default/description
CTorrent is a BitTorrent client written in the C programming language,
known to be a very robust and mature programming language, which produces
fast and optimized application.
endef
define Package/ctorrent-svn
$(call Package/ctorrent-svn/Default)
TITLE+= (with OpenSSL support)
DEPENDS+=+libopenssl
VARIANT:=ssl
endef
define Package/ctorrent-svn/description
$(call Package/ctorrent-svn/Default/description)
This package is built with OpenSSL support.
endef
define Package/ctorrent-svn-nossl
$(call Package/ctorrent-svn/Default)
TITLE+= (with builtin SHA-1)
VARIANT:=nossl
endef
define Package/ctorrent-svn-nossl/description
$(call Package/ctorrent-svn/Default/description)
This package is built with builtin (Steve Reid's public-domain) SHA-1 support
endef
CONFIGURE_VARS += \
CXX="g++-uc" \
LIBS="-nodefaultlibs -luClibc++ $(LIBGCC_S) -lc"
ifeq ($(BUILD_VARIANT),ssl)
CONFIGURE_ARGS += \
--with-ssl="$(STAGING_DIR)/usr"
endif
ifeq ($(BUILD_VARIANT),nossl)
CONFIGURE_ARGS += \
--with-ssl=no
endif
define Build/Configure
(cd $(PKG_BUILD_DIR); touch \
configure.ac \
aclocal.m4 \
Makefile.in \
config.h.in \
configure \
);
$(call Build/Configure/Default)
endef
define Package/ctorrent-svn/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ctorrent $(1)/usr/bin/ctorrent
endef
Package/ctorrent-svn-nossl/install = $(Package/ctorrent-svn/install)
$(eval $(call BuildPackage,ctorrent-svn))
$(eval $(call BuildPackage,ctorrent-svn-nossl))
@@ -0,0 +1,88 @@
diff --git a/btconfig.cpp b/btconfig.cpp
index e1badd0..aaa6feb 100644
--- a/btconfig.cpp
+++ b/btconfig.cpp
@@ -828,7 +828,7 @@ void CfgCTCS(Config<const char *> *config)
strncpy(CTCS.m_host, *cfg_ctcs, MAXHOSTNAMELEN-1);
CTCS.m_host[MAXHOSTNAMELEN-1] = '\0';
if( (s = strchr(CTCS.m_host, ':')) ) *s='\0';
- CTCS.m_port = atoi(s = (strchr(*cfg_ctcs, ':')+1));
+ CTCS.m_port = atoi(s = (char*)(strchr(*cfg_ctcs, ':')+1));
if( strchr(s, ':') )
CONSOLE.Input("Enter CTCS password: ", CTCS.m_pass, CTCS_PASS_SIZE);
else *CTCS.m_pass = '\0';
diff --git a/btcontent.cpp b/btcontent.cpp
index d84f450..88ccb50 100644
--- a/btcontent.cpp
+++ b/btcontent.cpp
@@ -1408,27 +1408,27 @@ void btContent::CompletionCommand()
ptmp = cmdstr + strlen(cmdstr);
parg = strstr(parg, "&t") + 2;
strcat(pt, parg);
- pt = strstr(ptmp, "&t");
- if( pd ) pd = strstr(ptmp, "&d");
- if( pw ) pw = strstr(ptmp, "&w");
+ pt = (char *)strstr(ptmp, "&t");
+ if( pd ) pd = (char *)strstr(ptmp, "&d");
+ if( pw ) pw = (char *)strstr(ptmp, "&w");
}
if( pd && (!pt || pd < pt) && (!pw || pd < pw) ){
strcpy(pd, m_btfiles.GetDataName());
ptmp = cmdstr + strlen(cmdstr);
parg = strstr(parg, "&d") + 2;
strcat(pd, parg);
- pd = strstr(ptmp, "&d");
- if( pt ) pt = strstr(ptmp, "&t");
- if( pw ) pw = strstr(ptmp, "&w");
+ pd = (char *)strstr(ptmp, "&d");
+ if( pt ) pt = (char *)strstr(ptmp, "&t");
+ if( pw ) pw = (char *)strstr(ptmp, "&w");
}
if( pw && (!pt || pw < pt) && (!pd || pw < pd) ){
strcpy(pw, wd);
ptmp = cmdstr + strlen(cmdstr);
parg = strstr(parg, "&w") + 2;
strcat(pw, parg);
- pw = strstr(ptmp, "&w");
- if( pt ) pt = strstr(ptmp, "&t");
- if( pd ) pd = strstr(ptmp, "&d");
+ pw = (char *)strstr(ptmp, "&w");
+ if( pt ) pt = (char *)strstr(ptmp, "&t");
+ if( pd ) pd = (char *)strstr(ptmp, "&d");
}
}
}
diff --git a/console.cpp b/console.cpp
index bdadb61..5ab2492 100644
--- a/console.cpp
+++ b/console.cpp
@@ -511,11 +511,8 @@ void ConStream::Error(int sev, const char *message, ...)
va_list ap;
va_start(ap, message);
- if( g_console_ready ) CONSOLE.Error(sev, message, ap);
- else{
vfprintf(stderr, message, ap);
fflush(stderr);
- }
va_end(ap);
}
@@ -1766,7 +1763,7 @@ void Console::Warning(int sev, const char *message, ...)
va_end(ap);
}
-
+/*
void Console::Error(int sev, const char *message, va_list ap)
{
vsnprintf(m_buffer, sizeof(m_buffer), message, ap);
@@ -1778,7 +1775,7 @@ void Console::Error(int sev, const char *message, va_list ap)
m_warnings.AddMessage(sev, m_buffer);
if( sev && *cfg_ctcs ) CTCS.Send_Info(sev, m_buffer);
}
-
+*/
void Console::Debug(const char *message, ...)
{
@@ -0,0 +1,14 @@
diff --git a/bencode.cpp b/bencode.cpp
index fef82ba..b7f14bc 100644
--- a/bencode.cpp
+++ b/bencode.cpp
@@ -45,6 +45,9 @@ size_t buf_int(const char *b, size_t len, char beginchar, char endchar,
p++;
len--;
}
+ if( *p == '-'){
+ p++; len--;
+ }
for( psave = p; len && isdigit(*p); p++, len-- );