~sourcemage/sorcery

de280f2600c50d38442196bcfab9643f82b6f1ce — Ismael Luceno 10 months ago d1fc581
sightsee: Allow multiple matches per line
1 files changed, 10 insertions(+), 5 deletions(-)

M usr/lib/sorcery/cmd/sightsee
M usr/lib/sorcery/cmd/sightsee => usr/lib/sorcery/cmd/sightsee +10 -5
@@ 9,11 9,16 @@ upstream_rel_get() {
    (curl) curl -s "$1" ;;
    (*) wget -q -O- "$1" ;;
  esac | gawk -vdebug="$debug" -vfname="$2" '
	match(tolower($0), fname, V) {
		$0 = substr($0, RSTART, RLENGTH)
		if (debug)
			printf "D: matched `%s`\n", $0 >"/dev/stderr"
		print V[1 in V]
	{
		while (match(tolower($0), fname, V)) {
			if (debug) {
				printf "D: matched `%s`\n", \
					substr($0, RSTART, RLENGTH) \
					>"/dev/stderr"
			}
			print V[1 in V]
			$0 = substr($0, RSTART + RLENGTH)
		}
	}
  ' | sort -urV
}