mirror of https://github.com/aria2/aria2
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.hpull/1/head
parent
cc4a14a1bc
commit
74c6599906
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include "message.h"
|
||||
#include "File.h"
|
||||
#include "FileEntry.h"
|
||||
#include "a2io.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
@ -576,24 +577,32 @@ 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)
|
||||
{
|
||||
File f(optarg);
|
||||
if(!f.exists() || f.isDir()) {
|
||||
throw DL_ABORT_EX
|
||||
(StringFormat(MSG_NOT_FILE, optarg.c_str()).str());
|
||||
if(_acceptStdin && optarg == "-") {
|
||||
option.put(_optName, DEV_STDIN);
|
||||
} else {
|
||||
File f(optarg);
|
||||
if(!f.exists() || f.isDir()) {
|
||||
throw DL_ABORT_EX
|
||||
(StringFormat(MSG_NOT_FILE, optarg.c_str()).str());
|
||||
}
|
||||
option.put(_optName, optarg);
|
||||
}
|
||||
option.put(_optName, optarg);
|
||||
}
|
||||
|
||||
virtual std::string createPossibleValuesString() const
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue