#! /usr/bin/perl # # $Id$ use strict; use warnings; use constant DIR_AD => "/usr/local/squid/etc/ad"; chdir DIR_AD or die "chdir ".DIR_AD.": $!"; my($patt)=""; open(M4,"-|","m4 -P main") or die "m4 run: $!"; while () { chomp; next if !$_; $patt.="|" if $patt; $patt.=$_; } close M4; select STDOUT; $|=1; while (<>) { s@^http://($patt).*\n$@http://localhost/cgi-bin/redirector-ad.cgi?$1\n@os; print; }