#!/bin/sh
# hp - Son Mr 18 18:03:22 GMT 2001
# <aumac-nolist> filename	appends "_nolist" to %macro lines in filename
#	$1: infile			substitute w. modified file
#	$1: infile $2:outfile		send modified $1 to $2

f=${1}

[ "${f}" == "$(basename ${0})" ]&&exit 0
grep "^\%macro\ " ${f} 2> /dev/null||exit 0

[ -z "${2}" ]&&o=${f}$$||o=${2}

# read line by line
IFS=
# single file
cat -v "${f}"|while read 'i';do [ -n "$(echo "${i}"|grep "^\%macro\ "|grep -v "[_\.]nolist")" ]&&echo "${i}_nolist">>${o}||echo "${i}">>${o};done
[ "${o}" == "${f}$$" ]&&mv -f ${o} ${f}

# aumac-nolist <eof>
