Subject: Re: bin/3138: [dM] mkdep(1) always uses /usr/bin/gcc
To: None <netbsd-bugs@NetBSD.ORG>
From: Mike Long <>
List: netbsd-bugs
Date: 02/05/1997 18:40:04
>Date: Tue, 4 Feb 1997 14:34:28 -0500 (EST)
>From: der Mouse  <mouse@Rodents.Montreal.QC.CA>
>>>> This would work without the -f; note that which(1) is required to
>>>> use the user's .cshrc.
>(Required by what?  Is there any standard for which?)

Actually, there isn't.  I found a draft of POSIX 1003.2; it says
nothing about which (nor csh).

>> Of course csh's builtin doesn't source .cshrc; csh has already *done*
>> that.
>But it may have done more than that.  If you set path in your .cshrc,
>the path used by historic (and tree-current NetBSD) shell-script which
>is the one set in your .cshrc, not the current one.  csh-builtin which
>uses the current one.
>These two paths are not necessarily the same.  You seem to be assuming
>they are.

That makes sense; but this desired behavior requires that a shell
builtin be used.  Only a builtin has access to both the current path
and all current shell aliases/functions.

We need to add a 'type' builtin to /bin/sh to comply with POSIX 1003.2
in any case.  Since mkdep(1) (the original subject of this thread) is
a sh script it should use 'type', not /usr/bin/which.

>Why not?  Essentially, what we ("we" = the people who want to replace
>/usr/bin/which with something like Arne's C program) are proposing is
>to redefine /usr/bin/which as a tool to locate a binary on $PATH.  This
>is not identical to what the csh's builtin which works, but neither is
>the current shellscript.  I, and apparently others, feel the historical
>semantics of the shellscript are an accident of the first
>implementation rather than being specifically desirable behavior, and
>as such feel no particular need to preserve them.

After thinking about your arguments I now agree with you that the
current behavior of /usr/bin/which is broken.  I still think Arne's C
program is overkill, however; something like:

#! /bin/csh -f
# ($NetBSD$, copyright, &c.)
which $*

should be sufficient.
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