#!/bin/sh
# filter
grep ^http:// | \
  sed -e 's@ftp://[^ ]*@@g' | \
  while read line ; do
    for url in $line ; do 
        base=`basename "$url"`
	[ -e /usr/portage/distfiles/$base ] && break
        pre=`echo $url|sed -e 's@http://@/k/net/Http@'`
        [ -e $pre ] && break
        pre=`echo $url|sed -e 's@http://@/o/net/Http@'`
        [ -e $pre ] && break
        echo $line
        break
      done

  done
