Subject: misc/627: bug in /usr/bin/cpp script
To: None <gnats-admin@sun-lamp.cs.berkeley.edu>
From: Giles Lean <giles@nemeton.com.au>
List: netbsd-bugs
Date: 12/10/1994 11:35:05
>Number:         627
>Category:       misc
>Synopsis:       /usr/bin/cpp wrapper doesn't handle -idirafter option
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people (Misc Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 10 11:35:03 1994
>Originator:     Giles Lean
>Organization:
Giles Lean   			  Nemeton Pty Ltd
<giles@nemeton.com.au>      phone: +61 3 480 2118
>Release:        1.0, -current (sup 9th December)
>Environment:
System: NetBSD nemeton.com.au 1.0 NetBSD 1.0 (NEMETON) #8: Sat Nov 26 17:12:42 EST 1994 giles@nemeton.com.au:/usr/src/sys/arch/i386/compile/NEMETON i386


>Description:
	/usr/bin/cpp cannot handle '-idirafter somedir', and
	/usr/libexec/cpp tries to read from standard input.

	(This construction is used by the /usr/share/mk/* files when
	DESTDIR is set.)

>How-To-Repeat:
	$ mkdir /tmp/include
	$ touch /tmp/a.c
	$ /usr/bin/cpp -idirafter /tmp/include /tmp/a.c
	^D

>Fix:

This doesn't do away with the /usr/bin/cpp script, but just
makes it a little less braindead.

*** /usr/local/bin/cpp	Sat Dec 10 14:03:46 1994
--- /usr/bin/cpp	Wed Nov 23 19:09:00 1994
***************
*** 49,59 ****
  INCS="-nostdinc"
  FOUNDFILES=no
  
! while [ $# -gt 0 ]
  do
- 	A="$1"
- 	shift
- 
  	case $A in
  	-nostdinc)
  		NSI=yes
--- 49,56 ----
  INCS="-nostdinc"
  FOUNDFILES=no
  
! for A
  do
  	case $A in
  	-nostdinc)
  		NSI=yes
***************
*** 65,74 ****
  		;;
  	-U__GNUC__)
  		ALST=`echo $ALST | sed -e 's/-D__GNUC__//'`
- 		;;
- 	-imacros|-include|-idirafter|-iprefix|-iwithprefix)
- 		OPTS="$OPTS '$A' '$1'"
- 		shift
  		;;
  	-*)
  		OPTS="$OPTS '$A'"
--- 62,67 ----
>Audit-Trail:
>Unformatted: