]> Sergey Matveev's repositories - nnn.git/commitdiff
A modular bookmark parser
authorArun Prakash Jana <engineerarun@gmail.com>
Wed, 17 Oct 2018 15:16:29 +0000 (20:46 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Wed, 17 Oct 2018 15:16:29 +0000 (20:46 +0530)
nnn.c

diff --git a/nnn.c b/nnn.c
index baed24768303e60325bddf03443bfbaea2bff19e..e23601cc7d18d3e8fb1f1e93fc9f2283803394e5 100644 (file)
--- 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) {