Nasty 4.3 change to cc(1)
Chris Torek
chris at umcp-cs.UUCP
Wed Aug 6 10:43:39 AEST 1986
In article <377 at curly.ucla-cs.ARPA>, das at LOCUS.UCLA.EDU writes:
>... Under 4.3,
> cc -c -o blah blah.c
>produces one object file, named blah, not blah.o!!!! ... I think
>the change is a mistake, since it breaks existing software and
>there's no compelling reason I can see to prefer the new meaning
>of -o over the old. Justifications?
I have no real idea why the change was installed; most likely
Berkeley got a request for it and saw no good reason *not* to
implement it. I remember a few years ago being surprised that
`cc -c -o x.o c.c' did not work this way. It is, however, trivial
to change it back. In /usr/src/bin/cc.c, find the four lines
if (cflag && nc==1 && outfile)
av[2] = outfile;
else
av[2] = setsuf(clist[i], 'o');
and remove the first three.
Alternatively, use a shell script to filter out `-o' whenever there
is at least one `-c':
#! /bin/sh
#
# cc - front end for /bin/cc to remove `extra' -o arguments (untested).
#
# Could use some speed improvement. Note that this does not handle
# whitespace in file names properly.
#
realcc=/bin/cc
fullargs=; nooargs=; cflag=false; noo=true
for i do
case "$i" in
-c) cflag=true; nooargs="$nooargs $i"; noo=true;;
-o) noo=false;;
*) if $noo; then nooargs="$nooargs $i"; fi; noo=true;;
esac
fullargs="$fullargs $i"
done
if $cflag; then exec $realcc $nooargs; else exec $realcc $fullargs; fi
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1516)
UUCP: seismo!umcp-cs!chris
CSNet: chris at umcp-cs ARPA: chris at mimsy.umd.edu
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list