#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
Go to the source code of this file.
|
char * | which (const char *cmd) |
|
int | whichp (const char *cmd) |
|
- Author
- Joachim Wiberg
- Date
- 2017-2021
- Copyright
- ISC License
Definition in file which.c.
◆ which()
char * which |
( |
const char * | cmd | ) |
|
Like which(1), or command -v foo
- Parameters
-
cmd | Command to look for in $PATH |
- Returns
- A malloc()'ed path to cmd on success, or
NULL
.
Definition at line 54 of file which.c.
◆ whichp()
int whichp |
( |
const char * | cmd | ) |
|
Predicate variant of which()
- Parameters
-
cmd | Command to look for in $PATH |
- Returns
TRUE(1)
or FALSE(0)
if cmd
exists in $PATH.
Definition at line 122 of file which.c.