libite 2.6.1
which.c File Reference
#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.

Functions

char * which (const char *cmd)
 
int whichp (const char *cmd)
 

Detailed Description

Author
Joachim Wiberg
Date
2017-2021

Definition in file which.c.

Function Documentation

◆ which()

char * which ( const char * cmd)

Like which(1), or command -v foo

Parameters
cmdCommand 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
cmdCommand to look for in $PATH
Returns
TRUE(1) or FALSE(0) if cmd exists in $PATH.

Definition at line 122 of file which.c.