libite
Functions
which.c File Reference
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
Include dependency graph for which.c:

Functions

char * which (const char *cmd)
 Like which(1), or command -v foo More...
 
int whichp (const char *cmd)
 Predicate variant of which() More...
 

Detailed Description

Author
Joachim Wiberg
Date
2017-2021

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.

◆ 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.