#! /bin/sh

files=`find . -name '*.h' | cut -d / -f 2- | xargs`

for _file in ${files}; do
	_guard=`echo ${_file} | tr a-z/. A-Z__`
	( echo '#ifndef	'${_guard} ; echo '#define	'${_guard} ; ( cat ${_file} | tail -n +3 | sed '$d' ) ; echo '#endif /* !'${_guard}' */' ) > x
	cat x > ${_file}
	rm x
done

#! /bin/sh

files=`find . -name '*.h' | grep -v uinet | cut -d / -f 2- | xargs`

for _file in ${files}; do
	_guard=`echo ${_file} | tr a-z/. A-Z__`
	( head -25 ${_file} ; echo '#ifndef	'${_guard} ; echo '#define	'${_guard} ; ( cat ${_file} | tail -n +28 | sed '$d' ) ; echo '#endif /* !'${_guard}' */' ) > x
	cat x > ${_file}
	rm x
done

Fix for addition of copyright block. Relies on exact copyright length, sadly. Should really look for existing guards?
Fix for addition of copyright block.  Relies on exact copyright length, sadly.  Should really look for existing guards?

