[net.bugs.usg] Bug in cxref

wescott@ncrcae.UUCP (Mike Wescott) (04/24/85)

There's a bug that shows up when using cxref.  Some files, when cxref'd
give syntax errors that aren't there.  The problem is in /usr/lib/xcpp,
the special version of cpp(1) used by cxref.  The cxref program invokes
xcpp on each file with a -F option.  The cpp.c code for the -F option
lacks a continue statement; therefore the program processes a spurious
-D option.  On my machine a spurious -Dsr occurred and caused syntax errors
on any file that had an "sr" variable declared.

Fix: in main() of /usr/src/cmd/cpp/cpp.c:

  #ifdef CXREF
		case 'F':
			if ((outfp = fopen(argv[++i],"w")) == NULL)
			{
				fprintf(stderr, "Can't open %s\n",
				    argv[i]);
				exit(1);
			}
+ 			continue; /* mcw: fix for cxref spurious -Dsr */
  #endif


--------------------------
	Mike Wescott
	ncrcae!wescott