aboutsummaryrefslogtreecommitdiffstats
path: root/src/nnn.c
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2018-12-16 20:29:03 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2018-12-16 20:29:03 +0530
commitcc34b977daa438bf3026724c25f25cb524574f16 (patch)
treee5aac05c5e240bff9c1e92fa3f7d97f873414deb /src/nnn.c
parentb15867143cf13b2cb93657f760a61681ae62378f (diff)
downloadnnn-cc34b977daa438bf3026724c25f25cb524574f16.tar.gz
Use run a command to launch apps
Diffstat (limited to 'src/nnn.c')
-rw-r--r--src/nnn.c45
1 files changed, 7 insertions, 38 deletions
diff --git a/src/nnn.c b/src/nnn.c
index e29c168..b707384 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -2062,9 +2062,9 @@ static bool show_help(char *path)
"d^J Disk usage S Apparent du\n"
"et Modification time s Size\n"
"1MISC\n"
- "a!, ^] Spawn SHELL in dir o Launch app\n"
- "d^S Run a command R Run custom script\n"
- "eC Execute entry L Lock terminal\n"};
+ "a!, ^] Spawn SHELL in dir C Execute entry\n"
+ "eR Run custom script L Lock terminal\n"
+ "d^S Run a command\n"};
if (fd == -1)
return FALSE;
@@ -3233,15 +3233,9 @@ nochange:
case SEL_RENAME:
if (!ndents)
break; // fallthrough
- case SEL_LAUNCH: // fallthrough
case SEL_NEW:
{
- char *ptr = NULL, *ptr1 = NULL, *ptr2 = NULL;
-
switch (sel) {
- case SEL_LAUNCH:
- tmp = xreadline(NULL, "launch: ");
- break;
case SEL_ARCHIVE:
tmp = xreadline(dents[cur].name, "name: ");
break;
@@ -3260,43 +3254,18 @@ nochange:
break;
/* Allow only relative, same dir paths */
- if ((sel != SEL_LAUNCH) &&
- (tmp[0] == '/' || strcmp(xbasename(tmp), tmp) != 0)) {
+ if (tmp[0] == '/' || strcmp(xbasename(tmp), tmp) != 0) {
printmsg(messages[STR_INPUT_ID]);
goto nochange;
}
/* Confirm if app is CLI or GUI */
- if (sel == SEL_OPEN || sel == SEL_LAUNCH) {
+ if (sel == SEL_OPEN) {
r = get_input("press 'c' for cli mode");
(r == 'c') ? (r = F_NORMAL) : (r = F_NOWAIT | F_NOTRACE);
}
switch (sel) {
- case SEL_LAUNCH:
- {
- uint args = 0;
- ptr = tmp;
-
- while (*ptr) {
- if (isblank(*ptr)) {
- *ptr = '\0';
- if (args == 0)
- ptr1 = ptr + 1;
- else if (args == 1)
- ptr2 = ptr + 1;
- else
- break;
-
- ++args;
- }
-
- ++ptr;
- }
-
- spawn(tmp, ptr1, ptr2, path, r);
- break;
- }
case SEL_ARCHIVE:
/* newpath is used as temporary buffer */
if (!getutil(utils[APACK])) {
@@ -3307,9 +3276,9 @@ nochange:
spawn(utils[APACK], tmp, dents[cur].name, path, F_NORMAL);
break;
case SEL_OPEN:
- getprogarg(tmp, &ptr);
+ getprogarg(tmp, &dir); /* dir used as tmp var */
mkpath(path, dents[cur].name, newpath, PATH_MAX);
- spawn(tmp, ptr, newpath, path, r);
+ spawn(tmp, dir, newpath, path, r);
break;
case SEL_RENAME:
/* Skip renaming to same name */