#!/sw/bin/perl $header = $ARGV[0]; shift @ARGV; $sources = join(" ", @ARGV); open(IN, "<$header"); open(OUT, ">$header.n"); while () { if (m|^/\*_BEGIN_PROTO_\*/|) { while () { last if (m|^/\*_END_PROTO_\*/|); } print OUT "/*_BEGIN_PROTO_*/\n"; open(CP, "cproto -DMKPROTO -e -f3 -v $sources 2>/dev/null|"); while () { if (m|^/\* .+\.c \*/|) { print OUT "\n"; } print OUT $_; } close(CP); print OUT "/*_END_PROTO_*/\n"; next; } print OUT $_; } close(OUT); close(IN); system("mv $header.n $header");