return t
}
+function ispre(s) {
+ if ((s~"pre")||(s~"PRE")||(s~"beta")||(s~"BETA")||(s~"alpha")||(s~"ALPHA")||(s~"rc")||(s~"RC")) {
+ if (DEBUG) print "pre-version"
+ return 1
+ } else {
+ return 0
+ }
+}
+
function compare_ver(v1,v2) {
# compares version numbers
while (match(v1,/[a-zA-Z][0-9]|[0-9][a-zA-Z]/))
return 1
else if (v1a[i]>v2a[i])
return 0
- } else if ((v1a[i]~"pre")||(v1a[i]~"beta")||(v1a[i]~"alpha")||(v1a[i]~"rc"))
+ } else if (ispre(v1a[i]) == 1)
return 1
else
return 0
}
if ((count2==mincount)&&(count!=count2)) {
for (i=count2+1; i<=count; i++)
- if ((v1a[i]~"pre")||(v1a[i]~"beta")||(v1a[i]~"alpha")||(v1a[i]~"rc"))
+ if (ispre(v1a[i]) == 1)
return 1
return 0
} else if (count!=count2) {
for (i=count+1; i<=count2; i++)
- if ((v2a[i]~"pre")||(v2a[i]~"beta")||(v2a[i]~"alpha")||(v2a[i]~"rc"))
+ if (ispre(v2a[i]) == 1)
return 0
return 1
}
return 1
else if (v1a[i]>v2a[i])
return 0
- } else if ((v1a[i]~"pre")||(v1a[i]~"beta")||(v1a[i]~"alpha")||(v1a[i]~"rc"))
+ } else if (ispre(v1a[i]) == 1)
return 1
else
return 0
}
if ((count2==mincount)&&(count!=count2)) {
for (i=count2+1; i<=count; i++)
- if ((v1a[i]~"pre")||(v1a[i]~"beta")||(v1a[i]~"alpha")||(v1a[i]~"rc"))
+ if (ispre(v1a[i]) == 1)
return 1
return 0
} else if (count!=count2) {
for (i=count+1; i<=count2; i++)
- if ((v2a[i]~"pre")||(v2a[i]~"beta")||(v2a[i]~"alpha")||(v2a[i]~"rc"))
+ if (ispre(v2a[i]) == 1)
return 0
return 1
}
if (tolower(odp) ~ /<frame[ \t]/) {
match(tolower(odp),/<frame[ \t][^>]*>/)
ramka=substr(odp,RSTART,RLENGTH)
- odp=substr(odp,RSTART+RLENGTH)
- sub(/[sS][rR][cC]=[ \t]+/,"src=",ramka);
- match(tolower(ramka),/src="[^"]+"/)
+ odp=substr(odp,1,RSTART) substr(odp,RSTART+RLENGTH)
+ sub(/[sS][rR][cC]=[ \t]*/,"src=",ramka);
+ match(ramka,/src="[^"]+"/)
newurl=substr(ramka,RSTART+5,RLENGTH-6)
if (DEBUG) print "Ramka: " newurl
if (newurl !~ /\//) {
if (DEBUG) print "Ramka->: " newurl
}
retval=(retval " " get_links(newurl))
- } else if (tolower(odp) ~ /href=[ \t]*"[^"]+"/) {
- sub(/[hH][rR][eE][fF]=[ \t]+/,"href=",odp)
- match(tolower(odp),/href="[^"]+"/)
+ } else if (tolower(odp) ~ /href=[ \t]*"[^"]*"/) {
+ sub(/[hH][rR][eE][fF]=[ \t]*"/,"href=\"",odp)
+ match(odp,/href="[^"]*"/)
+ link=substr(odp,RSTART,RLENGTH)
+ odp=substr(odp,1,RSTART) substr(odp,RSTART+RLENGTH)
+ link=substr(link,7,length(link)-7)
+ retval=(retval " " link)
+ if (DEBUG) print "href(\"\"): " link
+ } else if (tolower(odp) ~ /href=[ \t]*'[^']*'/) {
+ sub(/[hH][rR][eE][fF]=[ \t]*'/,"href='",odp)
+ match(odp,/href='[^']*'/)
link=substr(odp,RSTART,RLENGTH)
- odp=substr(odp,RSTART+RLENGTH)
+ odp=substr(odp,1,RSTART) substr(odp,RSTART+RLENGTH)
link=substr(link,7,length(link)-7)
retval=(retval " " link)
- } else if (tolower(odp) ~ /href=[ \t]*[^ \t>]+/) {
- sub(/[hH][rR][eE][fF]=[ \t]+/,"href=",odp)
- match(tolower(odp),/href=[^ \t>]+/)
+ if (DEBUG) print "href(''): " link
+ } else if (tolower(odp) ~ /href=[ \t]*[^ \t>]*/) {
+ sub(/[hH][rR][eE][fF]=[ \t]*/,"href=",odp)
+ match(odp,/href=[^ \t>]*/)
link=substr(odp,RSTART,RLENGTH)
- odp=substr(odp,RSTART+RLENGTH)
+ odp=substr(odp,1,RSTART) substr(odp,RSTART+RLENGTH)
link=substr(link,6,length(link)-5)
retval=(retval " " link)
+ if (DEBUG) print "href(): " link
} else {
retval=(retval " INTERNAL_ERROR")
break
filenameexp=filename
gsub("\+","\\+",filenameexp)
- sub(version,"[A-Za-z0-9\\.]+",filenameexp)
+ sub(version,"[A-Za-z0-9.]+",filenameexp)
+ gsub("\.","\\.",filenameexp)
if ( DEBUG ) print "Wzorzec: " filenameexp
match(filename,version)
prever=substr(filename,1,RSTART-1)
for (nr=1; nr<=c; nr++) {
addr=linki[nr]
if (DEBUG) print "Znaleziony link: " addr
- if ((addr ~ filenameexp) && !(addr ~ "[-_.0-9A-Za-z]" filenameexp)) {
+ if ((addr ~ filenameexp) && !(addr ~ "[-_.0-9A-Za-z~]" filenameexp)) {
match(addr,filenameexp)
newfilename=substr(addr,RSTART,RLENGTH)
if (DEBUG) print "Hipotetyczny nowy: " newfilename
newfilename=fixedsub(prever,"",newfilename)
newfilename=fixedsub(postver,"",newfilename)
if (DEBUG) print "Wersja: " newfilename
+ if (newfilename ~ /\.(pkg|bin|binary)$/) continue
if (NUMERIC) {
if ( compare_ver_dec(version, newfilename)==1 ) {
if (DEBUG) print "Tak, jest nowa"