Browse Source

Cleanup travis/spellcheck issues

pull/557/head
David Kerr 8 years ago
parent
commit
2e26aa11a6
  1. 49
      dnsapi/dns_freedns.sh

49
dnsapi/dns_freedns.sh

@ -1,4 +1,3 @@
#!/usr/bin/env sh
#This file name is "dns_freedns.sh"
@ -60,16 +59,16 @@ dns_freedns_add() {
# Now convert the tables in the HTML to CSV. This litte gem from
# http://stackoverflow.com/questions/1403087/how-can-i-convert-an-html-table-to-csv
subdomain_csv="$(echo $htmlpage |
grep -i -e '</\?TABLE\|</\?TD\|</\?TR\|</\?TH' |
sed 's/^[\ \t]*//g' |
tr -d '\n' |
sed 's/<\/TR[^>]*>/\n/Ig' |
sed 's/<\/\?\(TABLE\|TR\)[^>]*>//Ig' |
sed 's/^<T[DH][^>]*>\|<\/\?T[DH][^>]*>$//Ig' |
sed 's/<\/T[DH][^>]*><T[DH][^>]*>/,/Ig' |
grep 'edit.php?' |
grep $top_domain)"
subdomain_csv="$(echo $htmlpage \
| grep -i -e '</\?TABLE\|</\?TD\|</\?TR\|</\?TH' \
| sed 's/^[\ \t]*//g' \
| tr -d '\n' \
| sed 's/<\/TR[^>]*>/\n/Ig' \
| sed 's/<\/\?\(TABLE\|TR\)[^>]*>//Ig' \
| sed 's/^<T[DH][^>]*>\|<\/\?T[DH][^>]*>$//Ig' \
| sed 's/<\/T[DH][^>]*><T[DH][^>]*>/,/Ig' \
| grep 'edit.php?' \
| grep $top_domain)"
# The above beauty ends with striping out rows that do not have an
# href to edit.php and do not have the top domain we are looking for.
# So all we should be left with is CSV of table of subdomains we are
@ -78,8 +77,7 @@ dns_freedns_add() {
# Now we have to read through this table and extract the data we need
IFS=$'\n'
found=0
for line in $subdomain_csv
do
for line in $subdomain_csv; do
tmp="$(echo $line | cut -d ',' -f 1)"
if [ $found = 0 ] && _startswith "$tmp" "<td>$top_domain"; then
# this line will contain DNSdomainid for the top_domain
@ -189,16 +187,16 @@ dns_freedns_rm() {
# Now convert the tables in the HTML to CSV. This litte gem from
# http://stackoverflow.com/questions/1403087/how-can-i-convert-an-html-table-to-csv
subdomain_csv="$(echo $htmlpage |
grep -i -e '</\?TABLE\|</\?TD\|</\?TR\|</\?TH' |
sed 's/^[\ \t]*//g' |
tr -d '\n' |
sed 's/<\/TR[^>]*>/\n/Ig' |
sed 's/<\/\?\(TABLE\|TR\)[^>]*>//Ig' |
sed 's/^<T[DH][^>]*>\|<\/\?T[DH][^>]*>$//Ig' |
sed 's/<\/T[DH][^>]*><T[DH][^>]*>/,/Ig' |
grep 'edit.php?' |
grep $fulldomain)"
subdomain_csv="$(echo $htmlpage \
| grep -i -e '</\?TABLE\|</\?TD\|</\?TR\|</\?TH' \
| sed 's/^[\ \t]*//g' \
| tr -d '\n' \
| sed 's/<\/TR[^>]*>/\n/Ig' \
| sed 's/<\/\?\(TABLE\|TR\)[^>]*>//Ig' \
| sed 's/^<T[DH][^>]*>\|<\/\?T[DH][^>]*>$//Ig' \
| sed 's/<\/T[DH][^>]*><T[DH][^>]*>/,/Ig' \
| grep 'edit.php?' \
| grep $fulldomain)"
# The above beauty ends with striping out rows that do not have an
# href to edit.php and do not have the domain name we are looking for.
# So all we should be left with is CSV of table of subdomains we are
@ -206,8 +204,7 @@ dns_freedns_rm() {
# Now we have to read through this table and extract the data we need
IFS=$'\n'
for line in $subdomain_csv
do
for line in $subdomain_csv; do
dns_href="$(echo $line | cut -d ',' -f 2)"
tmp=${dns_href#*>}
DNSname=${tmp%%<*}
@ -359,7 +356,7 @@ _freedns_urlencode() {
c="${1:i:1}"
case $c in
[a-zA-Z0-9.~_-]) printf "$c" ;;
*) printf '%%%02X' "'$c"
*) printf '%%%02X' "'$c" ;;
esac
done
}
Loading…
Cancel
Save