]> git.nbdom.net Git - nb.git/commitdiff
url2nc
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 11 Dec 2016 22:16:09 +0000 (22:16 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 11 Dec 2016 22:16:09 +0000 (22:16 +0000)
etc/profile.d/functions

index 2587c20c7ae1955e20cc98bd2f3f5b913ff91342..37e512fed9866929c83ac1eb79b047bd0be82c2f 100644 (file)
@@ -595,35 +595,8 @@ url2nc() {
   local in="cat";
   [ -n "$*" ] && in="echo $*";
   eval $in | perl -ne ' BEGIN{%p=("ssh"=>22,"https"=>443,"http"=>80);}; /([\w\._-]+):(\d+)/ and print "$1 $2\n" and next; m,^\w+://, or $_="ssh://$_"; m,^(\w+)://(?:[^@]+@)?([\w\._-]+), and print "$2 ".($p{$1}||22)."\n" and next'
-  return
-  # NB 11.12.16: TODEL 
-  local IFS=$'\n'
-  eval $in | perl -MURI::Split -ne 'BEGIN{%port=("ssh"=>22,"https"=>443,"http"=>80);};
-    chomp($_);
-
-    if (/^([\.\w-_]+)\s+(\d+)$/) {
-      @_ = ($2,$1);
-    } else {
-      s,:([a-zAZ]),/$1,;
-      m,^\w+://, or $_="ssh://$_";
-      @_ = URI::Split::uri_split($_) or next;
-    if (0) { use Data::Dumper; warn Dumper(\@_); }
-      $_[1] =~ s/:(.*$)// and $_[2] = $1.$_[2];
-    }
-
-    $_=$_[1];
-    s/^[^@]+@//;
-
-    if ($_[0] =~ /^\d+$/) {
-      $_ .= " $_[0]";
-    } else {
-      s/:/ / or $_.=" ".$port{$_[0]||"ssh"};
-    }
-    print "$_\n"
-  '
 }
 
-
 ls_users() {
   case "$OSTYPE" in 
     darwin*)