mirror of
https://github.com/jarun/nnn.git
synced 2025-01-10 09:59:56 +00:00
A modular bookmark parser
This commit is contained in:
parent
f731664a99
commit
ecffa9087b
13
nnn.c
13
nnn.c
|
@ -1330,9 +1330,12 @@ mkpath(char *dir, char *name, char *out, size_t n)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
parsebmstr(char *bms)
|
parsebmstr()
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
char *bms = getenv("NNN_BMS");
|
||||||
|
if (!bms)
|
||||||
|
return;
|
||||||
|
|
||||||
while (*bms && i < BM_MAX) {
|
while (*bms && i < BM_MAX) {
|
||||||
bookmark[i].key = bms;
|
bookmark[i].key = bms;
|
||||||
|
@ -3368,7 +3371,7 @@ int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
static char cwd[PATH_MAX] __attribute__ ((aligned));
|
static char cwd[PATH_MAX] __attribute__ ((aligned));
|
||||||
char *ipath = NULL, *ifilter, *bmstr;
|
char *ipath = NULL, *ifilter;
|
||||||
int opt;
|
int opt;
|
||||||
|
|
||||||
/* Confirm we are in a terminal */
|
/* Confirm we are in a terminal */
|
||||||
|
@ -3413,10 +3416,8 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse bookmarks string, if available */
|
/* Parse bookmarks string */
|
||||||
bmstr = getenv("NNN_BMS");
|
parsebmstr();
|
||||||
if (bmstr)
|
|
||||||
parsebmstr(bmstr);
|
|
||||||
|
|
||||||
if (ipath) { /* Open a bookmark directly */
|
if (ipath) { /* Open a bookmark directly */
|
||||||
if (get_bm_loc(ipath, cwd) == NULL) {
|
if (get_bm_loc(ipath, cwd) == NULL) {
|
||||||
|
|
Loading…
Reference in a new issue