aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2018-11-28 17:53:28 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2018-11-28 17:53:28 +0530
commit5cae446aaf35170d052a6a3983f9ec3c47668a4a (patch)
tree3bf974c167fb43f4c5b117bfef4794b3563d8cab /src
parentd8df13f665b035cad0cceee48f388f4a9b03b9f2 (diff)
downloadnnn-5cae446aaf35170d052a6a3983f9ec3c47668a4a.tar.gz
xargs supports -a on Linux
Diffstat (limited to 'src')
-rw-r--r--src/nnn.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/src/nnn.c b/src/nnn.c
index aa6a6fe..ec023df 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -3098,12 +3098,31 @@ nochange:
goto nochange;
}
- if (sel == SEL_CP)
- snprintf(g_buf, MAX_CMD_LEN, "cat %s | xargs -0 -o -%c src cp -iRp src .", g_cppath, REPLACE_STR);
- else if (sel == SEL_MV)
- snprintf(g_buf, MAX_CMD_LEN, "cat %s | xargs -0 -o -%c src mv -i src .", g_cppath, REPLACE_STR);
- else /* SEL_RMMUL */
- snprintf(g_buf, MAX_CMD_LEN, "cat %s | xargs -0 -o rm -ir", g_cppath);
+ if (sel == SEL_CP) {
+ snprintf(g_buf, MAX_CMD_LEN,
+#ifdef __linux__
+ "xargs -0 -a %s -%c src cp -iRp src .",
+#else
+ "cat %s | xargs -0 -o -%c src cp -iRp src .",
+#endif
+ g_cppath, REPLACE_STR);
+ } else if (sel == SEL_MV) {
+ snprintf(g_buf, MAX_CMD_LEN,
+#ifdef __linux__
+ "xargs -0 -a %s -%c src mv -i src .",
+#else
+ "cat %s | xargs -0 -o -%c src mv -i src .",
+#endif
+ g_cppath, REPLACE_STR);
+ } else { /* SEL_RMMUL */
+ snprintf(g_buf, MAX_CMD_LEN,
+#ifdef __linux__
+ "xargs -0 -a %s rm -ir",
+#else
+ "cat %s | xargs -0 -o rm -ir",
+#endif
+ g_cppath);
+ }
spawn("sh", "-c", g_buf, path, F_NORMAL | F_SIGINT);