aboutsummaryrefslogtreecommitdiffstats
path: root/src/nnn.c
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-08-12 20:12:35 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-08-12 20:15:04 +0530
commite774634b5babc0c6bb972bdff796f5271671f7dc (patch)
treec448a20bf7ca368ab8e4f2ba76ead5e09bbd251b /src/nnn.c
parentedfcfdfdf47a561ee25e4bde75c6b2acd03efdd0 (diff)
downloadnnn-e774634b5babc0c6bb972bdff796f5271671f7dc.tar.gz
A simpler getutil()
Diffstat (limited to 'src/nnn.c')
-rw-r--r--src/nnn.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 7f021cf..fc3f499 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -479,7 +479,7 @@ static int spawn(char *file, char *arg1, char *arg2, const char *dir, uchar flag
static int (*nftw_fn)(const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf);
static int dentfind(const char *fname, int n);
static void move_cursor(int target, int ignore_scrolloff);
-static bool getutil(const char *util);
+static bool getutil(char *util);
/* Functions */
@@ -2542,14 +2542,9 @@ static char *get_output(char *buf, const size_t bytes, const char *file,
return NULL;
}
-static bool getutil(const char *util)
+static inline bool getutil(char *util)
{
- char buf[8];
-
- if (!get_output(buf, 8, "which", util, NULL, FALSE))
- return FALSE;
-
- return TRUE;
+ return spawn("which", util, NULL, NULL, F_NORMAL | F_NOTRACE) == 0;
}
/*