aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2018-10-17 20:46:29 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2018-10-17 20:46:29 +0530
commitecffa9087be5b26bfbb850919f894c333a834085 (patch)
tree968ca68ea32602c0f5ece5e83c8cb45037fa23ad
parentf731664a99dd7421d513e0d5b510f5e90c8181e9 (diff)
downloadnnn-ecffa9087be5b26bfbb850919f894c333a834085.tar.gz
A modular bookmark parser
-rw-r--r--nnn.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/nnn.c b/nnn.c
index baed247..e23601c 100644
--- a/nnn.c
+++ b/nnn.c
@@ -1330,9 +1330,12 @@ mkpath(char *dir, char *name, char *out, size_t n)
}
static void
-parsebmstr(char *bms)
+parsebmstr()
{
int i = 0;
+ char *bms = getenv("NNN_BMS");
+ if (!bms)
+ return;
while (*bms && i < BM_MAX) {
bookmark[i].key = bms;
@@ -3368,7 +3371,7 @@ int
main(int argc, char *argv[])
{
static char cwd[PATH_MAX] __attribute__ ((aligned));
- char *ipath = NULL, *ifilter, *bmstr;
+ char *ipath = NULL, *ifilter;
int opt;
/* Confirm we are in a terminal */
@@ -3413,10 +3416,8 @@ main(int argc, char *argv[])
}
}
- /* Parse bookmarks string, if available */
- bmstr = getenv("NNN_BMS");
- if (bmstr)
- parsebmstr(bmstr);
+ /* Parse bookmarks string */
+ parsebmstr();
if (ipath) { /* Open a bookmark directly */
if (get_bm_loc(ipath, cwd) == NULL) {