lpr,lpq: rework by dronnikov AT gmail.com
[oweals/busybox.git] / debianutils / which.c
index 79b2a4f830c76cbf5a55562be0be207699dc5123..5ab67194db37924cd642dd448ed1773e0dcb2029 100644 (file)
@@ -10,8 +10,9 @@
  * Based on which from debianutils
  */
 
-#include "busybox.h"
+#include "libbb.h"
 
+int which_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int which_main(int argc, char **argv)
 {
        int status = EXIT_SUCCESS;
@@ -21,8 +22,10 @@ int which_main(int argc, char **argv)
                bb_show_usage();
        }
 
+       /* This matches what is seen on e.g. ubuntu
+        * "which" there is a shell script */
        if (!getenv("PATH")) {
-               setenv("PATH", "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin", 1);
+               putenv((char*)bb_PATH_root_path);
        }
 
        while (--argc > 0) {