aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-11-17 19:17:39 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-11-17 19:17:39 +0530
commit0f5f04d087f886e3c732975afa3dd69bbcfc625a (patch)
treef3dc9ff0bd038e2d21ac35bc562e99e57fc750c1 /src
parent0620b1dfb5c5e9a66a210c6111ea829f4c5b4ab7 (diff)
downloadnnn-0f5f04d087f886e3c732975afa3dd69bbcfc625a.tar.gz
Revert "Fix #384: support busybox xargs"
Diffstat (limited to 'src')
-rw-r--r--src/nnn.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 9f6cd9b..b50f8d4 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -1278,7 +1278,7 @@ static bool xdiraccess(const char *path)
static void opstr(char *buf, char *op)
{
#ifdef __linux__
- snprintf(buf, CMD_LEN_MAX, "cat %s | xargs -0 -%c {} %s {} .", g_selpath, REPLACE_STR, op);
+ snprintf(buf, CMD_LEN_MAX, "xargs -0 -a %s -%c {} %s {} .", g_selpath, REPLACE_STR, op);
#else
snprintf(buf, CMD_LEN_MAX, "cat %s | xargs -0 -o -%c {} %s {} .", g_selpath, REPLACE_STR, op);
#endif
@@ -1286,12 +1286,17 @@ static void opstr(char *buf, char *op)
static void rmmulstr(char *buf)
{
- if (cfg.trash)
- snprintf(buf, CMD_LEN_MAX, "cat %s | xargs -0 trash-put", g_selpath);
- else {
+ if (cfg.trash) {
+ snprintf(buf, CMD_LEN_MAX,
+#ifdef __linux__
+ "xargs -0 -a %s trash-put", g_selpath);
+#else
+ "cat %s | xargs -0 trash-put", g_selpath);
+#endif
+ } else {
snprintf(buf, CMD_LEN_MAX,
#ifdef __linux__
- "cat %s | xargs -0 rm -%cr", g_selpath, confirm_force(TRUE));
+ "xargs -0 -a %s rm -%cr", g_selpath, confirm_force(TRUE));
#else
"cat %s | xargs -0 -o rm -%cr", g_selpath, confirm_force(TRUE));
#endif
@@ -1330,7 +1335,7 @@ static bool cpmv_rename(int choice, const char *path)
bool ret = FALSE;
char *cmd = (choice == 'c' ? cp : mv);
static const char formatcmd[] = "sed -i 's|^\\(\\(.*/\\)\\(.*\\)$\\)|#\\1\\n\\3|' %s";
- static const char renamecmd[] = "sed 's|^\\([^#][^/]\\?.*\\)$|%s/\\1|;s|^#\\(/.*\\)$|\\1|' %s | tr '\\n' '\\0' | xargs -0 -n2 %s";
+ static const char renamecmd[] = "sed 's|^\\([^#][^/]\\?.*\\)$|%s/\\1|;s|^#\\(/.*\\)$|\\1|' %s | tr '\\n' '\\0' | xargs -0 -o -n2 %s";
char buf[sizeof(renamecmd) + sizeof(cmd) + (PATH_MAX << 1)];
fd = create_tmp_file();