Use a more sensible var name

This commit is contained in:
Arun Prakash Jana 2019-01-19 10:07:04 +05:30
parent 867266431f
commit 91a31dc61d
No known key found for this signature in database
GPG key ID: A75979F35C080412

View file

@ -302,7 +302,7 @@ static char *copier;
static char *editor; static char *editor;
static char *pager, *pager_arg; static char *pager, *pager_arg;
static char *shell, *shell_arg; static char *shell, *shell_arg;
static char *runpath; static char *scriptpath;
static blkcnt_t ent_blocks; static blkcnt_t ent_blocks;
static blkcnt_t dir_blocks; static blkcnt_t dir_blocks;
static ulong num_files; static ulong num_files;
@ -2164,8 +2164,8 @@ static bool show_help(char *path)
dprintf(fd, "NNN_COPIER: %s\n", copier); dprintf(fd, "NNN_COPIER: %s\n", copier);
else if (g_cppath[0]) else if (g_cppath[0])
dprintf(fd, "copy file: %s\n", g_cppath); dprintf(fd, "copy file: %s\n", g_cppath);
if (runpath) if (scriptpath)
dprintf(fd, "NNN_SCRIPT: %s\n", runpath); dprintf(fd, "NNN_SCRIPT: %s\n", scriptpath);
if (getenv("NNN_SHOW_HIDDEN")) if (getenv("NNN_SHOW_HIDDEN"))
dprintf(fd, "NNN_SHOW_HIDDEN: 1\n"); dprintf(fd, "NNN_SHOW_HIDDEN: 1\n");
if (cfg.autoselect) if (cfg.autoselect)
@ -2757,7 +2757,7 @@ nochange:
continue; continue;
/* Must be in script directory to select script */ /* Must be in script directory to select script */
if (strcmp(path, runpath) != 0) if (strcmp(path, scriptpath) != 0)
continue; continue;
mkpath(path, dents[cur].name, newpath, PATH_MAX); mkpath(path, dents[cur].name, newpath, PATH_MAX);
@ -3457,12 +3457,12 @@ nochange:
spawn(shell, shell_arg, NULL, path, F_NORMAL | F_MARKER); spawn(shell, shell_arg, NULL, path, F_NORMAL | F_MARKER);
break; break;
case SEL_SCRIPT: case SEL_SCRIPT:
if (!runpath) { if (!scriptpath) {
printmsg("set NNN_SCRIPT"); printmsg("set NNN_SCRIPT");
goto nochange; goto nochange;
} }
if (stat(runpath, &sb) == -1) { if (stat(scriptpath, &sb) == -1) {
printwarn(); printwarn();
goto nochange; goto nochange;
} }
@ -3472,7 +3472,7 @@ nochange:
if (!cfg.runscript && rundir[0]) { if (!cfg.runscript && rundir[0]) {
/* If toggled, and still in the script dir, /* If toggled, and still in the script dir,
switch to original directory */ switch to original directory */
if (strcmp(path, runpath) == 0) { if (strcmp(path, scriptpath) == 0) {
xstrlcpy(path, rundir, PATH_MAX); xstrlcpy(path, rundir, PATH_MAX);
xstrlcpy(lastname, runfile, NAME_MAX); xstrlcpy(lastname, runfile, NAME_MAX);
rundir[0] = runfile[0] = '\0'; rundir[0] = runfile[0] = '\0';
@ -3483,11 +3483,11 @@ nochange:
} }
/* Check if directory is accessible */ /* Check if directory is accessible */
if (!xdiraccess(runpath)) if (!xdiraccess(scriptpath))
goto nochange; goto nochange;
xstrlcpy(rundir, path, PATH_MAX); xstrlcpy(rundir, path, PATH_MAX);
xstrlcpy(path, runpath, PATH_MAX); xstrlcpy(path, scriptpath, PATH_MAX);
if (ndents) if (ndents)
xstrlcpy(runfile, dents[cur].name, NAME_MAX); xstrlcpy(runfile, dents[cur].name, NAME_MAX);
cfg.runctx = cfg.curctx; cfg.runctx = cfg.curctx;
@ -3501,7 +3501,7 @@ nochange:
tmp = dents[cur].name; tmp = dents[cur].name;
else else
tmp = NULL; tmp = NULL;
spawn(shell, runpath, tmp, path, F_NORMAL | F_SIGINT); spawn(shell, scriptpath, tmp, path, F_NORMAL | F_SIGINT);
} }
break; break;
default: /* SEL_RUNCMD */ default: /* SEL_RUNCMD */
@ -3744,7 +3744,7 @@ int main(int argc, char *argv[])
getprogarg(shell, &shell_arg); getprogarg(shell, &shell_arg);
/* Setup script execution */ /* Setup script execution */
runpath = getenv("NNN_SCRIPT"); scriptpath = getenv("NNN_SCRIPT");
#ifdef LINUX_INOTIFY #ifdef LINUX_INOTIFY
/* Initialize inotify */ /* Initialize inotify */