zshrc: Comment out zurl().
authorJoerg Woelke <joewoe@fsmail.de>
Wed, 21 Jul 2010 16:10:26 +0000 (18:10 +0200)
committerFrank Terbeck <ft@grml.org>
Fri, 23 Jul 2010 08:45:38 +0000 (10:45 +0200)
Function is broken and violates Tinyurl's policy. Needs a rewrite.

Acked-by: Michael Prokop <mika@grml.org>
Acked-by: Frank Terbeck <ft@grml.org>
etc/zsh/zshrc

index 577c63f..720c81f 100644 (file)
@@ -4129,41 +4129,46 @@ if check_com -c highlight ; then
     compdef _hl_complete hl
 fi
 
+# TODO:
+# Rewrite this by either using tinyurl.com's API
+# or using another shortening service to comply with
+# tinyurl.com's policy.
+#
 # Create small urls via http://tinyurl.com using wget(1).
-function zurl() {
-    emulate -L zsh
-    [[ -z $1 ]] && { print "USAGE: zurl <URL>" ; return 1 }
-
-    local PN url tiny grabber search result preview
-    PN=$0
-    url=$1
-#   Check existence of given URL with the help of ping(1).
-#   N.B. ping(1) only works without an eventual given protocol.
-    ping -c 1 ${${url#(ftp|http)://}%%/*} >& /dev/null || \
-        read -q "?Given host ${${url#http://*/}%/*} is not reachable by pinging. Proceed anyway? [y|n] "
-
-    if (( $? == 0 )) ; then
-#           Prepend 'http://' to given URL where necessary for later output.
-            [[ ${url} != http(s|)://* ]] && url='http://'${url}
-            tiny='http://tinyurl.com/create.php?url='
-            if check_com -c wget ; then
-                grabber='wget -O- -o/dev/null'
-            else
-                print "wget is not available, but mandatory for ${PN}. Aborting."
-            fi
-#           Looking for i.e.`copy('http://tinyurl.com/7efkze')' in TinyURL's HTML code.
-            search='copy\(?http://tinyurl.com/[[:alnum:]]##*'
-            result=${(M)${${${(f)"$(${=grabber} ${tiny}${url})"}[(fr)${search}*]}//[()\';]/}%%http:*}
-#           TinyURL provides the rather new feature preview for more confidence. <http://tinyurl.com/preview.php>
-            preview='http://preview.'${result#http://}
-
-            printf '%s\n\n' "${PN} - Shrinking long URLs via webservice TinyURL <http://tinyurl.com>."
-            printf '%s\t%s\n\n' 'Given URL:' ${url}
-            printf '%s\t%s\n\t\t%s\n' 'TinyURL:' ${result} ${preview}
-    else
-        return 1
-    fi
-}
+#function zurl() {
+#    emulate -L zsh
+#    [[ -z $1 ]] && { print "USAGE: zurl <URL>" ; return 1 }
+#
+#    local PN url tiny grabber search result preview
+#    PN=$0
+#    url=$1
+##   Check existence of given URL with the help of ping(1).
+##   N.B. ping(1) only works without an eventual given protocol.
+#    ping -c 1 ${${url#(ftp|http)://}%%/*} >& /dev/null || \
+#        read -q "?Given host ${${url#http://*/}%/*} is not reachable by pinging. Proceed anyway? [y|n] "
+#
+#    if (( $? == 0 )) ; then
+##           Prepend 'http://' to given URL where necessary for later output.
+#            [[ ${url} != http(s|)://* ]] && url='http://'${url}
+#            tiny='http://tinyurl.com/create.php?url='
+#            if check_com -c wget ; then
+#                grabber='wget -O- -o/dev/null'
+#            else
+#                print "wget is not available, but mandatory for ${PN}. Aborting."
+#            fi
+##           Looking for i.e.`copy('http://tinyurl.com/7efkze')' in TinyURL's HTML code.
+#            search='copy\(?http://tinyurl.com/[[:alnum:]]##*'
+#            result=${(M)${${${(f)"$(${=grabber} ${tiny}${url})"}[(fr)${search}*]}//[()\';]/}%%http:*}
+##           TinyURL provides the rather new feature preview for more confidence. <http://tinyurl.com/preview.php>
+#            preview='http://preview.'${result#http://}
+#
+#            printf '%s\n\n' "${PN} - Shrinking long URLs via webservice TinyURL <http://tinyurl.com>."
+#            printf '%s\t%s\n\n' 'Given URL:' ${url}
+#            printf '%s\t%s\n\t\t%s\n' 'TinyURL:' ${result} ${preview}
+#    else
+#        return 1
+#    fi
+#}
 
 #f2# Print a specific line of file(s).
 linenr () {