diff --git a/linkcheck/Config.py b/linkcheck/Config.py index 90bb86c2..90399f1f 100644 --- a/linkcheck/Config.py +++ b/linkcheck/Config.py @@ -483,8 +483,6 @@ class Configuration (UserDict.UserDict): except ConfigParser.Error, msg: debug(NIGHTMARE, msg) try: num = cfgparser.getint(section, "recursionlevel") - if num<0: - error(i18n._("illegal recursionlevel number %d") % num) self["recursionlevel"] = num except ConfigParser.Error, msg: debug(NIGHTMARE, msg) try: diff --git a/linkcheck/UrlData.py b/linkcheck/UrlData.py index 6facf639..3470978a 100644 --- a/linkcheck/UrlData.py +++ b/linkcheck/UrlData.py @@ -330,7 +330,8 @@ class UrlData: return self.valid and \ self.isHtml() and \ not self.cached and \ - self.recursionLevel < self.config["recursionlevel"] and \ + (self.config["recursionlevel"] >= 0 and + self.recursionLevel < self.config["recursionlevel"]) and \ not self.extern[0] diff --git a/linkchecker b/linkchecker index 8a66288c..cba665da 100755 --- a/linkchecker +++ b/linkchecker @@ -96,7 +96,8 @@ For single-letter option arguments the space is not a necessity. So -q, --quiet Quiet operation. This is only useful with -F. -r depth, --recursion-level=depth - Check recursively all links up to given depth (depth >= 0). + Check recursively all links up to given depth. A negative depth + will enable inifinite recursion. Default depth is 1. -s, --strict Check only syntax of extern links, do not try to connect to them. @@ -323,11 +324,15 @@ for opt,arg in options: config["quiet"] = 1 elif opt=="-r" or opt=="--recursion-level": + try: + depth = int(arg) + except ValueError: + printUsage(i18n._("Illegal argument %s for option %s") % \ + (`arg`, "'-r, --recursion-level'")) if int(arg) >= 0: config["recursionlevel"] = int(arg) else: - printUsage((i18n._("Illegal argument '%s' for option ") % arg) + - "'-r, --recursion-level'") + config["recursionlevel"] = -1 # robots.txt is now default, so ignore this option elif opt=="-R" or opt=="--robots-txt": pass diff --git a/linkchecker.1 b/linkchecker.1 index 6a7cc418..50dac572 100644 --- a/linkchecker.1 +++ b/linkchecker.1 @@ -94,7 +94,8 @@ Default is no pause between requests. Quiet operation. This is only useful with \fB-F\fP. .TP \fB-r \fIdepth\fP, \fB--recursion-level=\fIdepth\fP -Check recursively all links up to given \fIdepth\fP (depth >= 0). +Check recursively all links up to given \fIdepth\fP. +A negative depth will enable inifinite recursion. Default depth is 1. .TP \fB-s\fP, \fB--strict\fP