[PATCH 0/2] fix find_execable function and which code cleanup

Ralf Friedl Ralf.Friedl at online.de
Fri May 2 13:42:40 UTC 2014


Tito wrote:

> That's it about PATCH 1.
> There is still PATCH 2....
Your patch searches in PATH for dir/file if dir/file is not executable. 
The normal behavior is to not search PATH if the argument contains a '/'.

If you rewrite "which" anyway, you could also change the following points:
- Remove default PATH, saves some bytes
- Output message if not found (maybe if DESKTOP)
- Return number of commands not found as per man page (Which returns the 
number of failed arguments, or -1 when no `programname´ was given)
$ which -v
GNU which v2.20, Copyright (C) 1999 - 2008 Carlo Wood.
$ (unset PATH; /usr/bin/which -a sh bash; echo $?)
/usr/bin/which: no sh in ((null))
/usr/bin/which: no bash in ((null))
2



More information about the busybox mailing list