#!/usr/bin/mawk -f

# extract Fax-Nr xyzt ... from
# a Postscript file. Used by "fax".
# Dic 2000, M. Andreoli for muLinux
# (very ugly, but it works)

BEGIN {
ps=0;
phone=0;
}

END {
}

/^%!PS/ 		{ ps=1; next;}
/[0-9]+[ ]\(%\)[A-Z]/ 	{ get_phone();}
//		{}

function get_phone()
{
getline L
split(L,field)
split(field[3],tmp,"[\(\)]");
phone=tmp[2];
printf phone;
exit 0;
}
