#!/bin/sh
#
# Script used to configure the xvt makefile.  Run as cmake FOO BAR it will
#
#	uncomment all lines containing #FOO followed by BAR on the same line
#
#	comment out all lines containing #FOO not followed by BAR
#
#	leave all other lines unchanged
#
if test $# -eq 1
then
	arg="none"
elif test $# -eq 2
then
	arg=$2
else
	echo "usage is cmake arg1 [ arg2 ]" >&2
	exit 1
fi
awk '
/#'$1'.*'$arg'/	{
		if ($0 ~ /^#/)
			printf("%s\n",substr($0,2));
		else
			printf("%s\n",$0);
		next;
	}
/#'$1'/ {
		if ($0 ~ /^#/)
			printf("%s\n",$0);
		else
			printf("#%s\n",$0);
		next;
	}
	{
		print $0;
	}
'
