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>
|
2009-12-08 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Fixed the bug that aria2 listens wrong port if --interface option
|
Fixed the bug that aria2 listens wrong port if --interface option
|
||||||
|
|
|
@ -1184,6 +1184,7 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
|
||||||
(PREF_TORRENT_FILE,
|
(PREF_TORRENT_FILE,
|
||||||
TEXT_TORRENT_FILE,
|
TEXT_TORRENT_FILE,
|
||||||
NO_DEFAULT_VALUE,
|
NO_DEFAULT_VALUE,
|
||||||
|
false,
|
||||||
'T'));
|
'T'));
|
||||||
op->addTag(TAG_BASIC);
|
op->addTag(TAG_BASIC);
|
||||||
op->addTag(TAG_BITTORRENT);
|
op->addTag(TAG_BITTORRENT);
|
||||||
|
@ -1215,6 +1216,7 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
|
||||||
(PREF_METALINK_FILE,
|
(PREF_METALINK_FILE,
|
||||||
TEXT_METALINK_FILE,
|
TEXT_METALINK_FILE,
|
||||||
NO_DEFAULT_VALUE,
|
NO_DEFAULT_VALUE,
|
||||||
|
true,
|
||||||
'M'));
|
'M'));
|
||||||
op->addTag(TAG_BASIC);
|
op->addTag(TAG_BASIC);
|
||||||
op->addTag(TAG_METALINK);
|
op->addTag(TAG_METALINK);
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
#include "message.h"
|
#include "message.h"
|
||||||
#include "File.h"
|
#include "File.h"
|
||||||
#include "FileEntry.h"
|
#include "FileEntry.h"
|
||||||
|
#include "a2io.h"
|
||||||
|
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
|
|
||||||
|
@ -576,18 +577,25 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
class LocalFilePathOptionHandler : public NameMatchOptionHandler {
|
class LocalFilePathOptionHandler : public NameMatchOptionHandler {
|
||||||
|
private:
|
||||||
|
bool _acceptStdin;
|
||||||
public:
|
public:
|
||||||
LocalFilePathOptionHandler
|
LocalFilePathOptionHandler
|
||||||
(const std::string& optName,
|
(const std::string& optName,
|
||||||
const std::string& description = NO_DESCRIPTION,
|
const std::string& description = NO_DESCRIPTION,
|
||||||
const std::string& defaultValue = NO_DEFAULT_VALUE,
|
const std::string& defaultValue = NO_DEFAULT_VALUE,
|
||||||
|
bool acceptStdin = false,
|
||||||
char shortName = 0):
|
char shortName = 0):
|
||||||
NameMatchOptionHandler(optName, description, defaultValue,
|
NameMatchOptionHandler(optName, description, defaultValue,
|
||||||
OptionHandler::REQ_ARG,
|
OptionHandler::REQ_ARG,
|
||||||
shortName) {}
|
shortName),
|
||||||
|
_acceptStdin(acceptStdin) {}
|
||||||
|
|
||||||
virtual void parseArg(Option& option, const std::string& optarg)
|
virtual void parseArg(Option& option, const std::string& optarg)
|
||||||
{
|
{
|
||||||
|
if(_acceptStdin && optarg == "-") {
|
||||||
|
option.put(_optName, DEV_STDIN);
|
||||||
|
} else {
|
||||||
File f(optarg);
|
File f(optarg);
|
||||||
if(!f.exists() || f.isDir()) {
|
if(!f.exists() || f.isDir()) {
|
||||||
throw DL_ABORT_EX
|
throw DL_ABORT_EX
|
||||||
|
@ -595,6 +603,7 @@ public:
|
||||||
}
|
}
|
||||||
option.put(_optName, optarg);
|
option.put(_optName, optarg);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
virtual std::string createPossibleValuesString() const
|
virtual std::string createPossibleValuesString() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -103,10 +103,12 @@
|
||||||
# define DEV_NULL "/dev/null"
|
# define DEV_NULL "/dev/null"
|
||||||
#endif // HAVE_WINSOCK2_H
|
#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
|
#ifdef HAVE_WINSOCK2_H
|
||||||
|
# define DEV_STDIN "con"
|
||||||
# define DEV_STDOUT "con"
|
# define DEV_STDOUT "con"
|
||||||
#else
|
#else
|
||||||
|
# define DEV_STDIN "/dev/stdin"
|
||||||
# define DEV_STDOUT "/dev/stdout"
|
# define DEV_STDOUT "/dev/stdout"
|
||||||
#endif // HAVE_WINSOCK2_H
|
#endif // HAVE_WINSOCK2_H
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue