Subject: Re: bin/3138: [dM] mkdep(1) always uses /usr/bin/gcc
To: None <>
From: Mike Long <>
List: netbsd-bugs
Date: 02/03/1997 14:40:44
>From: "Arne H. Juul" <>
>Date: Sun, 2 Feb 1997 21:51:36 +0100 (MET)
>On Fri, 31 Jan 1997, Chris G. Demetriou wrote:
> > use of 'which' is a fatal flaw in this patch.

>On Sat, 1 Feb 1997, Christos Zoulas wrote:
> > Which is a nasty csh program. It sources your .cshrc with $prompt defined,
> > and checks each component of the path and aliases for the word(s) you pass
> > it. If you are not using csh this is losing.
> > 
> > A better fix is to add a whence builtin in the Bourne shell, but I still
> > don't like this much.

Doesn't POSIX.2 define the 'type' builtin in sh(1), which is what
should be used to find binaries (and shell functions, &c.)?

>Argh - I had hoped we would long ago have replaced that very nasty
>hack.  Even when I was a die-hard csh user I found the csh-script "which"
>to be extremely unhelpful and wrong.  And now csh actually has a built-in
>which, so the script should at least be:
>	#!/bin/csh -f
>	which $*

This would work without the -f; note that which(1) is required to use
the user's .cshrc.

>Actually, since this came up, I found a strong urge to write a sane C
>version of "which"; appended.  Comments are welcome;  send-pr will
>follow later.  If this goes in the original patch from der Mouse should
>be OK too :-)

A C program is no good because it doesn't use .cshrc, as specified by
which(1).  In order to do so it would have to parse .cshrc, at which
point you might as well have used csh in the first place.
Mike Long <>     <URL:>
VLSI Design Engineer         finger for PGP public key
Analog Devices, CPD Division          CCBF225E7D3F7ECB2C8F7ABB15D9BE7B
Norwood, MA 02062 USA       (eq (opinion 'ADI) (opinion 'mike)) -> nil