[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-patches
Subject:    Re: Improve vxWorks support on x86
From:       Manfred Hollstein <manfred () s-direktnet ! de>
Date:       1999-01-31 11:47:55
[Download RAW message or body]

On Sat, 30 January 1999, 19:10:32, zack@rabi.columbia.edu wrote:

 > On Fri, 29 Jan 1999 10:25:23 +0100 (MET), Manfred Hollstein wrote:
 > >On Tue, 26 January 1999, 10:50:03, zack@rabi.columbia.edu wrote:
 > > > Does anyone know why the trivial
 > > > 
 > > > #! /bin/sh
 > > > exec gcc -E ${1+"$@"}
 > > > 
 > > > won't work?
 > >
 > >Two reasons:
 > >
 > >  1. Reading from stdin won't work
 > >  2. gcc issues warnings like
 > >       gcc: /home/manfred//.holiday: linker input file unused since linking no
 > >t done
 > >     for files with unknown extensions.
 > >
 > >This is the script I posted last year:
 > 
 > Checking file existence to decide whether to read stdin is too magical
 > for my taste.  I'd do it like this:
 > 
 > #! /bin/sh
 > 
 > dash=-
 > for f in "$@"
 > do
 > 	case "$f" in
 > 		-) dash=; break;;
 > 		-*) ;;
 > 		*) dash=; break;;
 > 	esac
 > done
 > 
 > exec gcc -E -xc ${1+"$@"} $dash

Agreed, that's even better.  One remark though: you should use

for f

instead of the explicit

for f in "$@"

to avoid parameter grouping problems in (very old and) lame shells.

manfred

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic