static blkcnt_t ent_blocks;
static blkcnt_t dir_blocks;
static ulong num_files;
-static kv bookmark[BM_MAX + 1];
+static kv bookmark[BM_MAX];
static kv plug[PLUGIN_MAX];
static uchar g_tmpfplen;
static uchar blk_shift = BLK_SHIFT_512;
static void browse(char *ipath, const char *session)
{
char newpath[PATH_MAX] __attribute__ ((aligned));
+ char mark[PATH_MAX] __attribute__ ((aligned));
char rundir[PATH_MAX] __attribute__ ((aligned));
char runfile[NAME_MAX + 1] __attribute__ ((aligned));
char *path, *lastdir, *lastname, *dir, *tmp;
g_ctx[0].c_cfg = cfg; /* current configuration */
}
- newpath[0] = rundir[0] = runfile[0] = '\0';
+ newpath[0] = rundir[0] = runfile[0] = mark[0] = '\0';
presel = cfg.filtermode ? FILTER : 0;
r = get_input(NULL);
if (!get_kv_val(bookmark, newpath, r, BM_MAX, TRUE)) {
- if (r == ',' && bookmark[BM_MAX].val)
- xstrlcpy(newpath, bookmark[BM_MAX].val, PATH_MAX);
+ if (r == ',' && mark[0])
+ xstrlcpy(newpath, mark, PATH_MAX);
else {
printwait(messages[MSG_INVALID_KEY], &presel);;
goto nochange;
}
}
+
+
if (!xdiraccess(newpath)) {
printwait(messages[MSG_ACCESS], &presel);
goto nochange;
setdirwatch();
goto begin;
case SEL_PIN:
- bookmark[BM_MAX].val = xrealloc(bookmark[BM_MAX].val, strlen(path));
- xstrlcpy(bookmark[BM_MAX].val, path, PATH_MAX);
- printwait(bookmark[BM_MAX].val, &presel);
+ xstrlcpy(mark, path, PATH_MAX);
+ printwait(mark, &presel);
goto nochange;
case SEL_FLTR:
/* Unwatch dir if we are still in a filtered view */
free(cfgdir);
free(initpath);
free(bmstr);
- free(bookmark[BM_MAX].val);
free(pluginstr);
unlink(g_pipepath);
fprintf(stderr, "%s\n", env_cfg[NNN_BMS]);
return _FAILURE;
}
- bookmark[BM_MAX].key = ','; /* Set key for pinned dir */
/* Parse plugins string */
if (!parsekvpair(plug, &pluginstr, "NNN_PLUG", PLUGIN_MAX)) {