mirror of
https://github.com/troglobit/libite.git
synced 2026-10-20 11:09:33 +00:00
Add whichp() predicate function to which()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
4dd9459f65
commit
3dde2922c3
3 files changed
+20
-1
No files matched your search
@@ -81,6 +81,22 @@ char *which(const char *cmd)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Like which(), above, but only answers TRUE(1)/FALSE(0)
|
||||
*/
|
||||
int whichp(const char *cmd)
|
||||
{
|
||||
char *path;
|
||||
|
||||
path = which(cmd);
|
||||
if (path) {
|
||||
free(path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Local Variables:
|
||||
* indent-tabs-mode: t
|
||||
|
||||
Reference in new issue
Block a user