static struct timespec gtimeout;
#endif
+/* Macros for utilities */
+#define MEDIAINFO 0
+#define EXIFTOOL 1
+#define OPENER 2
+#define NLAY 3
+#define ATOOL 4
+#define VIDIR 5
+
/* Utilities to open files, run actions */
static char * const utils[] = {
"mediainfo",
static int
handle_archive(char *fpath, char *arg, char *dir)
{
- if (!get_output(g_buf, MAX_CMD_LEN, "which", utils[4], NULL, 0))
+ if (!get_output(g_buf, MAX_CMD_LEN, "which", utils[ATOOL], NULL, 0))
return -1;
if (arg[1] == 'x')
- spawn(utils[4], arg, fpath, dir, F_NORMAL);
+ spawn(utils[ATOOL], arg, fpath, dir, F_NORMAL);
else {
exitcurses();
- get_output(NULL, 0, utils[4], arg, fpath, 1);
+ get_output(NULL, 0, utils[ATOOL], arg, fpath, 1);
refresh();
}
}
/* Invoke desktop opener as last resort */
- spawn(utils[2], newpath, NULL, NULL, nowait);
+ spawn(utils[OPENER], newpath, NULL, NULL, nowait);
continue;
}
default:
if (sel == SEL_MEDIA || sel == SEL_FMEDIA)
xstrlcpy(newpath + 8, utils[cfg.metaviewer], 32);
else
- xstrlcpy(newpath + 8, utils[4], 32);
+ xstrlcpy(newpath + 8, utils[ATOOL], 32);
printmsg(newpath);
goto nochange;
xstrlcpy(oldname, tmp, NAME_MAX + 1);
goto begin;
case SEL_RENAMEALL:
- if (!get_output(g_buf, MAX_CMD_LEN, "which", utils[5], NULL, 0)) {
+ if (!get_output(g_buf, MAX_CMD_LEN, "which", utils[VIDIR], NULL, 0)) {
printmsg("vidir missing");
goto nochange;
}
goto nochange;
}
- spawn(utils[5], ".", NULL, NULL, F_NORMAL);
+ spawn(utils[VIDIR], ".", NULL, NULL, F_NORMAL);
/* Change back to program start dir */
if (chdir(newpath) == -1)
cfg.color = (uchar)atoi(optarg);
break;
case 'e':
- cfg.metaviewer = 1;
+ cfg.metaviewer = EXIFTOOL;
break;
case 'p':
player = optarg;
/* Set player if not set already */
if (!player)
- player = utils[3];
+ player = utils[NLAY];
/* Get the desktop file browser, if set */
desktop_manager = getenv("NNN_DE_FILE_MANAGER");