#!/bin/sh
src="$1"
dst="$2"
if test -L "$src"; then
exec cp -a "$src" "$dst"
fi
awk 'BEGIN { FS="[ >]" }
{ if ($0 ~ /^<inc (.+)>$/) { system("test -e src/doc/include/"$2" \
&& cat src/doc/include/"$2" || cat comain/src/doc/include/"$2) }
else { print } } ' "$src" > "$dst"