2009-12-09 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

If '-' is given as an argument to --metalink-file option, aria2
	reads Metalink file from stdin.
	* src/OptionHandlerFactory.cc
	* src/OptionHandlerImpl.h
	* src/a2io.h
pull/1/head
Tatsuhiro Tsujikawa 2009-12-09 14:32:12 +00:00
parent cc4a14a1bc
commit 74c6599906
4 changed files with 28 additions and 7 deletions

View File

@ -1,3 +1,11 @@
2009-12-09 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
If '-' is given as an argument to --metalink-file option, aria2
reads Metalink file from stdin.
* src/OptionHandlerFactory.cc
* src/OptionHandlerImpl.h
* src/a2io.h
2009-12-08 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug that aria2 listens wrong port if --interface option

View File

@ -1184,6 +1184,7 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
(PREF_TORRENT_FILE,
TEXT_TORRENT_FILE,
NO_DEFAULT_VALUE,
false,
'T'));
op->addTag(TAG_BASIC);
op->addTag(TAG_BITTORRENT);
@ -1215,6 +1216,7 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
(PREF_METALINK_FILE,
TEXT_METALINK_FILE,
NO_DEFAULT_VALUE,
true,
'M'));
op->addTag(TAG_BASIC);
op->addTag(TAG_METALINK);

View File

@ -56,6 +56,7 @@
#include "message.h"
#include "File.h"
#include "FileEntry.h"
#include "a2io.h"
namespace aria2 {
@ -576,18 +577,25 @@ public:
};
class LocalFilePathOptionHandler : public NameMatchOptionHandler {
private:
bool _acceptStdin;
public:
LocalFilePathOptionHandler
(const std::string& optName,
const std::string& description = NO_DESCRIPTION,
const std::string& defaultValue = NO_DEFAULT_VALUE,
bool acceptStdin = false,
char shortName = 0):
NameMatchOptionHandler(optName, description, defaultValue,
OptionHandler::REQ_ARG,
shortName) {}
shortName),
_acceptStdin(acceptStdin) {}
virtual void parseArg(Option& option, const std::string& optarg)
{
if(_acceptStdin && optarg == "-") {
option.put(_optName, DEV_STDIN);
} else {
File f(optarg);
if(!f.exists() || f.isDir()) {
throw DL_ABORT_EX
@ -595,6 +603,7 @@ public:
}
option.put(_optName, optarg);
}
}
virtual std::string createPossibleValuesString() const
{

View File

@ -103,10 +103,12 @@
# define DEV_NULL "/dev/null"
#endif // HAVE_WINSOCK2_H
// Use 'con' instead of '/dev/stdout' in win32.
// Use 'con' instead of '/dev/stdin' and '/dev/stdout' in win32.
#ifdef HAVE_WINSOCK2_H
# define DEV_STDIN "con"
# define DEV_STDOUT "con"
#else
# define DEV_STDIN "/dev/stdin"
# define DEV_STDOUT "/dev/stdout"
#endif // HAVE_WINSOCK2_H