V7/bin/pcc

Find at most related files.
including files from this version of Unix.

T=/tmp/$$ PATH=/bin:/usr/bin O= OTWO= S= N=yes OPT= ret=0 prof=
L=/lib COPT=/lib/c2
LC="$L/crt0.o" LIBS=" $L/libc.a" NAS=as LD=ld CCOMP=/usr/lib/ccom
ECHO=echo
trap "rm -f $T.*; exit 1" 1 2 3 15
trap 'rm -f $T.*; exit $ret' 0
for A
do	case $A in
	*.c)	B=`basename $A .c`
		$ECHO "$B.c"
		case "$S$OPT" in
		-S)	if /lib/cpp $O $A $T.i &&
			   $CCOMP $prof <$T.i $OTWO >$B.s; then
				: OK
			else
				ret=$?
			fi ;;
		-Syes)	if /lib/cpp $O $A $T.i &&
			   $CCOMP $prof <$T.i $OTWO >$T.s &&
			   $COPT $T.s $B.s; then
				: OK
			else
				ret=$?
			fi ;;
		yes)	if /lib/cpp $O $A $T.i &&
			    $CCOMP $prof <$T.i $OTWO >$T.x &&
			    $COPT $T.x  $T.s &&
			    $NAS - -o $B.o $T.s ; then
				ll="$ll $B.o"
			else
				N=no ret=$?
			fi ;;
		*)	if /lib/cpp $O $A $T.i &&
			   $CCOMP $prof <$T.i $OTWO >$T.s &&
			    $NAS - -o $B.o $T.s ; then
				ll="$ll $B.o"
			else
				N=no ret=$?
			fi ;;
		esac ;;

	-S)	N=no S=-S OTWO=-l ;;

	-X)	CCOMP=/usr/scj/pcc/comp ;;

	-O)	OPT=yes ;;

	-[IDU]*)	O="$O $A" ;;

	-c)	N=no ;;

	-)	ECHO=: ;;

	*.s)	B=`basename $A .s`
		if echo "$B.s:" &&
		$NAS - -o $B.o $A; then
			ll="$ll $B.o"
		else
			N=no ret=$?
		fi ;;

	-p)	prof=-p  ;;

	*)	ll="$ll $A"
	esac
done
case $N in
	no)	: ;;
	*)	$LD $LC $ll $LIBS
	ret=$?
esac