SPECS: pldnotify.awk - display wget error message

arekm arekm at pld-linux.org
Mon Dec 1 10:08:45 CET 2008


Author: arekm                        Date: Mon Dec  1 09:08:45 2008 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- display wget error message

---- Files affected:
SPECS:
   pldnotify.awk (1.68 -> 1.69) 

---- Diffs:

================================================================
Index: SPECS/pldnotify.awk
diff -u SPECS/pldnotify.awk:1.68 SPECS/pldnotify.awk:1.69
--- SPECS/pldnotify.awk:1.68	Mon Dec  1 10:00:08 2008
+++ SPECS/pldnotify.awk	Mon Dec  1 10:08:40 2008
@@ -164,9 +164,15 @@
 
 function get_links(url,filename,errno,link,oneline,retval,odp,wholeodp,lowerodp,tmpfile) {
 # get all <A HREF=..> tags from specified URL
+
+	wholeerr=""
+
 	"mktemp /tmp/XXXXXX" | getline tmpfile
 	close(tmpfile)
 
+	"mktemp /tmp/errXXXXXX" | getline tmpfileerr
+	close(tmpfileerr)
+
 	if (url ~ /^http:\/\/(download|dl).(sf|sourceforge).net\//) {
 		gsub("^http://(download|dl).(sf|sourceforge).net/", "", url)
 		url = "http://prdownloads.sourceforge.net/" substr(url, 1, 1) "/" substr(url, 1, 2) "/" url
@@ -193,16 +199,25 @@
 
 
 	if (DEBUG) print "Retrieving: " url
-	errno=system("wget -O - \"" url "\" -t 2 -T 45 --passive-ftp > " tmpfile " 2>/dev/null" )
+	errno=system("wget -nv -O - \"" url "\" -t 2 -T 45 --passive-ftp > " tmpfile " 2> " tmpfileerr )
 
 	if (errno==0) {
 		while (getline oneline < tmpfile)
 			wholeodp=(wholeodp " " oneline)
 		if ( DEBUG ) print "Response: " wholeodp
+	} else {
+		wholeerr = ""
+		while (getline oneline < tmpfileerr)
+			wholeerr=(wholeerr " " oneline)
+		if ( DEBUG ) print "Error Response: " wholeerr
 	}
 
 	close(tmpfile)
 	system("rm -f " tmpfile)
+
+	close(tmpfileerr)
+	system("rm -f " tmpfileerr)
+
 	urldir=url;
 	sub(/[^\/]+$/,"",urldir)
 
@@ -276,7 +291,7 @@
 			}
 		}
 	} else {
-		retval=("WGET ERROR: " errno)
+		retval=("WGET ERROR: " errno ": " wholeerr)
 	}
 
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SPECS/pldnotify.awk?r1=1.68&r2=1.69&f=u



More information about the pld-cvs-commit mailing list