From 15586812c56fa3aaefe1339804b3e876cfdac25a Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 30 Nov 2008 09:35:27 +0000 Subject: [PATCH] 2008-11-30 Tatsuhiro Tsujikawa Print a message when no files to download. * src/download_helper.cc * src/main.cc * src/message.h --- ChangeLog | 7 +++++++ src/download_helper.cc | 2 +- src/main.cc | 6 +++++- src/message.h | 1 + 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1f4f620f..e5efae76 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-11-30 Tatsuhiro Tsujikawa + + Print a message when no files to download. + * src/download_helper.cc + * src/main.cc + * src/message.h + 2008-11-28 Tatsuhiro Tsujikawa RFC3986 complied Percent-Encoding(urlencode). diff --git a/src/download_helper.cc b/src/download_helper.cc index be8b8016..9f9e6b46 100644 --- a/src/download_helper.cc +++ b/src/download_helper.cc @@ -153,7 +153,7 @@ void createRequestGroupForMetalink { Metalink2RequestGroup(op).generate(result, op->get(PREF_METALINK_FILE), *op); if(result.empty()) { - throw FatalException("No files to download."); + throw FatalException(MSG_NO_FILES_TO_DOWNLOAD); } } #endif // ENABLE_METALINK diff --git a/src/main.cc b/src/main.cc index 5b210f81..26405810 100644 --- a/src/main.cc +++ b/src/main.cc @@ -146,6 +146,7 @@ int main(int argc, char* argv[]) DefaultBtContextHandle btContext(new DefaultBtContext()); btContext->load(op->get(PREF_TORRENT_FILE)); std::cout << btContext << std::endl; + return EXIT_SUCCESS; } else { createRequestGroupForBitTorrent(requestGroups, op, args); } @@ -161,6 +162,7 @@ int main(int argc, char* argv[]) std::deque > fileEntries; MetalinkEntry::toFileEntry(fileEntries, metalinkEntries); Util::toStream(std::cout, fileEntries); + return EXIT_SUCCESS; } else { createRequestGroupForMetalink(requestGroups, op); } @@ -173,7 +175,9 @@ int main(int argc, char* argv[]) createRequestGroupForUri(requestGroups, op, args); } - if(!requestGroups.empty()) { + if(requestGroups.empty()) { + std::cout << MSG_NO_FILES_TO_DOWNLOAD << std::endl; + } else { returnValue = MultiUrlRequestInfo(requestGroups, op, getStatCalc(op), getSummaryOut(op)).execute(); } diff --git a/src/message.h b/src/message.h index 4cb54c99..7cb17920 100644 --- a/src/message.h +++ b/src/message.h @@ -163,6 +163,7 @@ _("Certificate verification failed. Cause: %s") #define MSG_NO_CERT_FOUND _("No certificate found.") #define MSG_HOSTNAME_NOT_MATCH _("Hostname not match.") +#define MSG_NO_FILES_TO_DOWNLOAD _("No files to download.") #define EX_TIME_OUT _("Timeout.") #define EX_INVALID_CHUNK_SIZE _("Invalid chunk size.")