#! /bin/sh

# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# <flz@FreeBSD.ORG> wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return    Florent Thoumie
# ----------------------------------------------------------------------------

pfctl="/sbin/pfctl"
cpp="/usr/bin/cpp"
confdir="/etc"

_list="$*"
_config=${_list##*-f\ }
_config=${_config%%\ *}

if [ -z "${_config}" -o "${_config##-}" != "${_config}" ]; then
	exec ${pfctl} ${_list}
else
	_list=`echo ${_list} | sed "s|-f ${_config}|-f -|"`
	exec ${cpp} -P -x c -E -I${confdir} ${_config} 2>/dev/null | sed 's|#.*||' | ${pfctl} ${_list}
fi

