summaryrefslogtreecommitdiff
path: root/usr.bin/which
diff options
context:
space:
mode:
authorIgor Sobrado <sobrado@cvs.openbsd.org>2010-05-31 14:01:50 +0000
committerIgor Sobrado <sobrado@cvs.openbsd.org>2010-05-31 14:01:50 +0000
commitd9b3c32e4aff6b65cbe9e8cf3be6729bc626f648 (patch)
treeb79b1b1fcfdd0ff2722b642c87b5206e1b6cc834 /usr.bin/which
parente5955f8851764136f2259115f5db7def90e28ef0 (diff)
stderr should be used for error messages; this diff makes which(1)
output not only more standard but also more predictable, as it now matches the behavior of the csh(1)'s built-in command. diff from Tobias Ulmer. ok millert@
Diffstat (limited to 'usr.bin/which')
-rw-r--r--usr.bin/which/which.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/which/which.c b/usr.bin/which/which.c
index b0ed1d30842..220d082c93a 100644
--- a/usr.bin/which/which.c
+++ b/usr.bin/which/which.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: which.c,v 1.15 2009/10/27 23:59:50 deraadt Exp $ */
+/* $OpenBSD: which.c,v 1.16 2010/05/31 14:01:49 sobrado Exp $ */
/*
* Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -120,13 +120,13 @@ findprog(char *prog, char *path, int progmode, int allmatches)
(void)puts(prog);
return (1);
} else {
- (void)printf("%s: Command not found.\n", prog);
+ warnx("%s: Command not found.", prog);
return (0);
}
}
if ((path = strdup(path)) == NULL)
- errx(1, "Can't allocate memory.");
+ err(1, "strdup");
pathcpy = path;
proglen = strlen(prog);
@@ -159,7 +159,7 @@ findprog(char *prog, char *path, int progmode, int allmatches)
/* whereis(1) is silent on failure. */
if (!rval && progmode != PROG_WHEREIS)
- (void)printf("%s: Command not found.\n", prog);
+ warnx("%s: Command not found.", prog);
return (rval);
}