Browse Source

Fix build break

master
Arun Prakash Jana 6 years ago
parent
commit
fc7a21f6e1
No known key found for this signature in database GPG Key ID: A75979F35C080412
1 changed files with 13 additions and 27 deletions
  1. +13
    -27
      src/nnn.c

+ 13
- 27
src/nnn.c View File

@@ -2917,15 +2917,11 @@ static void browse(char *ipath)
lastname = g_ctx[0].c_name; /* last visited filename */ lastname = g_ctx[0].c_name; /* last visited filename */
g_ctx[0].c_cfg = cfg; /* current configuration */ g_ctx[0].c_cfg = cfg; /* current configuration */


if (cfg.filtermode)
presel = FILTER;
else
presel = 0;
cfg.filtermode ? (presel = FILTER) : (presel = 0);


dents = xrealloc(dents, total_dents * sizeof(struct entry)); dents = xrealloc(dents, total_dents * sizeof(struct entry));
if (dents == NULL) if (dents == NULL)
errexit(); errexit();
DPRINTF_P(dents);


/* Allocate buffer to hold names */ /* Allocate buffer to hold names */
pnamebuf = (char *)xrealloc(pnamebuf, NAMEBUF_INCR); pnamebuf = (char *)xrealloc(pnamebuf, NAMEBUF_INCR);
@@ -2933,7 +2929,6 @@ static void browse(char *ipath)
free(dents); free(dents);
errexit(); errexit();
} }
DPRINTF_P(pnamebuf);


begin: begin:
#ifdef LINUX_INOTIFY #ifdef LINUX_INOTIFY
@@ -3067,11 +3062,9 @@ nochange:


/* Handle script selection mode */ /* Handle script selection mode */
if (cfg.runscript) { if (cfg.runscript) {
if (cfg.runctx != cfg.curctx)
continue;

/* Must be in script directory to select script */
if (strcmp(path, scriptpath) != 0)
if ((cfg.runctx != cfg.curctx)
/* Must be in script directory to select script */
|| (strcmp(path, scriptpath) != 0))
continue; continue;


mkpath(path, dents[cur].name, newpath); mkpath(path, dents[cur].name, newpath);
@@ -3146,10 +3139,7 @@ nochange:
case SEL_VISIT: case SEL_VISIT:
switch (sel) { switch (sel) {
case SEL_CDHOME: case SEL_CDHOME:
if (home)
dir = home;
else
dir = path;
home ? (dir = home) : (dir = path);
break; break;
case SEL_CDBEGIN: case SEL_CDBEGIN:
dir = ipath; dir = ipath;
@@ -3577,10 +3567,7 @@ nochange:
printmsg("selection off"); printmsg("selection off");
goto nochange; goto nochange;
case SEL_COPYLIST: case SEL_COPYLIST:
if (copybufpos)
showcplist();
else
printmsg("none selected");
copybufpos ? showcplist() : printmsg("none selected");
goto nochange; goto nochange;
case SEL_CP: case SEL_CP:
case SEL_MV: case SEL_MV:
@@ -3888,10 +3875,12 @@ nochange:
} }
break; break;
default: /* SEL_RUNCMD */ default: /* SEL_RUNCMD */
if (cfg.picker)
if (cfg.picker) {
/* readline prompt breaks the interface, use stock */
tmp = xreadline(NULL, "> "); tmp = xreadline(NULL, "> ");
else {
/* Use libreadline */
if (tmp[0])
spawn(shell, "-c", tmp, path, F_NORMAL | F_SIGINT);
} else {
exitcurses(); exitcurses();


/* Switch to current path for readline(3) */ /* Switch to current path for readline(3) */
@@ -3908,12 +3897,9 @@ nochange:
} }


refresh(); refresh();
}


if (tmp && tmp[0]) {
spawn(shell, "-c", tmp, path, F_NORMAL | F_SIGINT);
/* The ideal check is !cfg.picker */
if (tmp != g_buf) {
if (tmp && tmp[0]) {
spawn(shell, "-c", tmp, path, F_NORMAL | F_SIGINT);
/* readline finishing touches */ /* readline finishing touches */
add_history(tmp); add_history(tmp);
free(tmp); free(tmp);


Loading…
Cancel
Save