aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2018-11-28 05:57:27 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2018-11-28 05:57:27 +0530
commit2a4cc85659f247704811da02338a8137908522b8 (patch)
treed32c46315b7e7e9d6081f052abcdd035ac7f1a1d /src
parent8ac68fcc5be4089acfda4c2c476cef6542456e43 (diff)
downloadnnn-2a4cc85659f247704811da02338a8137908522b8.tar.gz
cp, mv: use replacement string with xargs
Diffstat (limited to 'src')
-rw-r--r--src/nnn.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 7a0ac90..93d4c32 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -322,6 +322,15 @@ static uint KQUEUE_FFLAGS = NOTE_DELETE | NOTE_EXTEND | NOTE_LINK | NOTE_RENAME
static struct timespec gtimeout;
#endif
+/* Replace-str for xargs on different platforms */
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__)
+#define REPLACE_STR 'J'
+#elif defined(__linux__) || defined(__CYGWIN__)
+#define REPLACE_STR 'I'
+#else
+#define REPLACE_STR 'I'
+#endif
+
/* Macros for utilities */
#define MEDIAINFO 0
#define EXIFTOOL 1
@@ -3083,9 +3092,9 @@ nochange:
}
if (sel == SEL_CP)
- snprintf(g_buf, MAX_CMD_LEN, "cat %s | xargs -0 -o cp -iRp -t .", g_cppath);
+ 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 mv -i -t .", g_cppath);
+ 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);