Browse Source

2010-03-19 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

	Lines starting "#" in -i list are treated as comments.
	Example:
	# this is comment
	http://example.org/file
	http://example.org/file2
	  dir=/tmp
	# another comment
	  out=myfile
	* doc/aria2c.1.txt
	* src/UriListParser.cc
	* test/filelist1.txt
Tatsuhiro Tsujikawa 15 years ago
parent
commit
e0335dcd4f
6 changed files with 26 additions and 2 deletions
  1. 14 0
      ChangeLog
  2. 2 0
      doc/aria2c.1
  3. 2 1
      doc/aria2c.1.html
  4. 2 0
      doc/aria2c.1.txt
  5. 4 1
      src/UriListParser.cc
  6. 2 0
      test/filelist1.txt

+ 14 - 0
ChangeLog

@@ -1,3 +1,17 @@
+2010-03-19  Tatsuhiro Tsujikawa  <t-tujikawa@users.sourceforge.net>
+
+	Lines starting "#" in -i list are treated as comments.
+	Example:
+	# this is comment
+	http://example.org/file
+	http://example.org/file2
+	  dir=/tmp
+	# another comment
+	  out=myfile
+	* doc/aria2c.1.txt
+	* src/UriListParser.cc
+	* test/filelist1.txt
+
 2010-03-19  Tatsuhiro Tsujikawa  <t-tujikawa@users.sourceforge.net>
 2010-03-19  Tatsuhiro Tsujikawa  <t-tujikawa@users.sourceforge.net>
 
 
 	Accept IPv4 network address with CIDR block in --no-proxy option
 	Accept IPv4 network address with CIDR block in --no-proxy option

+ 2 - 0
doc/aria2c.1

@@ -1426,6 +1426,8 @@ The input file can contain a list of URIs for aria2 to download\&. You can speci
 .sp
 .sp
 Each line is treated as if it is provided in command\-line argument\&. Therefore they are affected by \fB\-Z\fR and \fB\-P\fR options\&.
 Each line is treated as if it is provided in command\-line argument\&. Therefore they are affected by \fB\-Z\fR and \fB\-P\fR options\&.
 .sp
 .sp
+Lines starting with "#" are treated as comments and skipped\&.
+.sp
 Additionally, the following options can be specified after each line of URIs\&. These optional lines must start with white space(s)\&.
 Additionally, the following options can be specified after each line of URIs\&. These optional lines must start with white space(s)\&.
 .sp
 .sp
 .RS 4
 .RS 4

+ 2 - 1
doc/aria2c.1.html

@@ -2349,6 +2349,7 @@ can specify multiple URIs for a single entity: separate URIs on a
 single line using the TAB character.</p></div>
 single line using the TAB character.</p></div>
 <div class="paragraph"><p>Each line is treated as if it is provided in command-line argument.
 <div class="paragraph"><p>Each line is treated as if it is provided in command-line argument.
 Therefore they are affected by <strong>-Z</strong> and <strong>-P</strong> options.</p></div>
 Therefore they are affected by <strong>-Z</strong> and <strong>-P</strong> options.</p></div>
+<div class="paragraph"><p>Lines starting with "#" are treated as comments and skipped.</p></div>
 <div class="paragraph"><p>Additionally, the following options can be specified after each line
 <div class="paragraph"><p>Additionally, the following options can be specified after each line
 of URIs. These optional lines must start with white space(s).</p></div>
 of URIs. These optional lines must start with white space(s).</p></div>
 <div class="ulist"><ul>
 <div class="ulist"><ul>
@@ -3983,7 +3984,7 @@ files in the program, then also delete it here.</p></div>
 <div id="footnotes"><hr /></div>
 <div id="footnotes"><hr /></div>
 <div id="footer">
 <div id="footer">
 <div id="footer-text">
 <div id="footer-text">
-Last updated 2010-03-19 17:37:54 JST
+Last updated 2010-03-19 18:13:05 JST
 </div>
 </div>
 </div>
 </div>
 </body>
 </body>

+ 2 - 0
doc/aria2c.1.txt

@@ -1047,6 +1047,8 @@ single line using the TAB character.
 Each line is treated as if it is provided in command-line argument.
 Each line is treated as if it is provided in command-line argument.
 Therefore they are affected by *-Z* and *-P* options.
 Therefore they are affected by *-Z* and *-P* options.
 
 
+Lines starting with "#" are treated as comments and skipped.
+
 Additionally, the following options can be specified after each line
 Additionally, the following options can be specified after each line
 of URIs. These optional lines must start with white space(s).
 of URIs. These optional lines must start with white space(s).
 
 

+ 4 - 1
src/UriListParser.cc

@@ -41,6 +41,7 @@
 #include "Option.h"
 #include "Option.h"
 #include "OptionHandlerFactory.h"
 #include "OptionHandlerFactory.h"
 #include "OptionHandler.h"
 #include "OptionHandler.h"
+#include "A2STR.h"
 
 
 namespace aria2 {
 namespace aria2 {
 
 
@@ -57,6 +58,8 @@ void UriListParser::getOptions(Option& op)
   while(getline(_in, _line)) {
   while(getline(_in, _line)) {
     if(util::startsWith(_line, " ")) {
     if(util::startsWith(_line, " ")) {
       ss << _line << "\n";
       ss << _line << "\n";
+    } else if(util::startsWith(_line, A2STR::SHARP_C)) {
+      continue;
     } else {
     } else {
       break;
       break;
     }
     }
@@ -73,7 +76,7 @@ void UriListParser::parseNext(std::vector<std::string>& uris, Option& op)
     return;
     return;
   }
   }
   do {
   do {
-    if(!util::trim(_line).empty()) {
+    if(!util::startsWith(_line, A2STR::SHARP_C) && !util::trim(_line).empty()) {
       util::split(_line, std::back_inserter(uris), "\t", true);
       util::split(_line, std::back_inserter(uris), "\t", true);
       getOptions(op);
       getOptions(op);
       return;
       return;

+ 2 - 0
test/filelist1.txt

@@ -1,5 +1,7 @@
+# comment line
 http://localhost/index.html	http://localhost2/index.html
 http://localhost/index.html	http://localhost2/index.html
 
 
 ftp://localhost/aria2.tar.bz2
 ftp://localhost/aria2.tar.bz2
   dir=/tmp
   dir=/tmp
+# comment line
   out=chunky_chocolate
   out=chunky_chocolate