commit - ae5756808c915ca9a760e969eb55971346aac807
commit + bd72d1f8183acdd12a96abe9a1bd6cb26f9b5a77
blob - 866a659f99387f1f8f6944d66a26327313d8d39f
blob + b6a74d7cffd66d7be451099151c52d9418338d3b
--- config.h
+++ config.h
/* Optional macro to be executed when a batch operation finishes. */
#define RV_ALERT() beep()
-/* Shell used to launch external programs. */
+/* Shell used to launch external programs.
+ Defining this macro will force Rover to launch external
+ programs with `sh -c "$EXTERNAL_PROGRAM [arg]"`. This gives more
+ flexibility, allowing command-line arguments to be embedded in
+ environment variables (e.g. PAGER="less -N"). On the other hand,
+ this requires the presence of a shell and will spawn an additional
+ process each time an external program is invoked. Leave this macro
+ undefined if you prefer external programs to be launched with just
+ `$EXTERNAL_PROGRAM [arg]`. */
#define RV_SHELL "/bin/sh"
blob - 3dca3b5149b958d64a9f5d0a723b296fbccb2fda
blob + ef44d7b5a6a8a19134fdd144703155b0668218f6
--- rover.c
+++ rover.c
} else if (!strcmp(key, RVK_SHELL)) {
program = getenv("SHELL");
if (program) {
+#ifdef RV_SHELL
spawn((char *[]) {RV_SHELL, "-c", program, NULL});
+#else
+ spawn((char *[]) {program, NULL});
+#endif
reload();
}
} else if (!strcmp(key, RVK_VIEW)) {
if (!rover.nfiles || S_ISDIR(EMODE(ESEL))) continue;
program = getenv("PAGER");
if (program) {
+#ifdef RV_SHELL
strncpy(BUF1, program, BUFLEN - 1);
strncat(BUF1, " ", BUFLEN - strlen(program) - 1);
strncat(BUF1, ENAME(ESEL),
BUFLEN - strlen(program) - strlen(ENAME(ESEL)) - 2);
spawn((char *[]) {RV_SHELL, "-c", BUF1, NULL});
+#else
+ spawn((char *[]) {program, ENAME(ESEL), NULL});
+#endif
}
} else if (!strcmp(key, RVK_EDIT)) {
if (!rover.nfiles || S_ISDIR(EMODE(ESEL))) continue;
program = getenv("EDITOR");
if (program) {
+#ifdef RV_SHELL
strncpy(BUF1, program, BUFLEN - 1);
strncat(BUF1, " ", BUFLEN - strlen(program) - 1);
strncat(BUF1, ENAME(ESEL),
BUFLEN - strlen(program) - strlen(ENAME(ESEL)) - 2);
spawn((char *[]) {RV_SHELL, "-c", BUF1, NULL});
+#else
+ spawn((char *[]) {program, ENAME(ESEL), NULL});
+#endif
cd(0);
}
} else if (!strcmp(key, RVK_SEARCH)) {