;; shows links underlined in the text
;; usage $links(text www.link.de text?)
alias links {
if ($isid) {
set -un %a $1-
tokenize 124 www.*.??*|ftp://*.??*|http://*.??*|*?@???*.??*
var %x = $0 | while (%x) { rep $($+($,%x),2) %a | dec %x }
tokenize 32 %a | unset %a | return $1-
}
else { !links $1- }
}
alias -l rep { if ($wildtok($2-,$1,0,32)) { var %i = $ifmatch,%y,%x | %y = $2- | while (%i) { %x = $wildtok(%y,$1,%i,32) | if ( !isin %x) { %a = $replace(%a,%x, $+ $wildtok(%y,$1,%i,32) $+ ) } | dec %i } } }