mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Revert "Fix #384: support busybox xargs"
This reverts commit 407b690404
.
This commit is contained in:
parent
0620b1dfb5
commit
0f5f04d087
|
@ -88,7 +88,7 @@ A curses library with wide char support (e.g. ncursesw), libreadline (`make O_NO
|
||||||
| Dependency | Installation | Operation |
|
| Dependency | Installation | Operation |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| xdg-open (Linux), open(1) (macOS), cygstart (Cygwin) | base | desktop opener |
|
| xdg-open (Linux), open(1) (macOS), cygstart (Cygwin) | base | desktop opener |
|
||||||
| file, coreutils (cp, mv, rm), xargs | base | file type, copy, move and remove |
|
| file, coreutils (cp, mv, rm), findutils (xargs) | base | file type, copy, move and remove |
|
||||||
| tar, (un)zip [atool/bsdtar for more formats] | base | create, list, extract tar, gzip, bzip2, zip |
|
| tar, (un)zip [atool/bsdtar for more formats] | base | create, list, extract tar, gzip, bzip2, zip |
|
||||||
| archivemount, fusermount(3) | optional | mount, unmount archives |
|
| archivemount, fusermount(3) | optional | mount, unmount archives |
|
||||||
| sshfs, fusermount(3) | optional | mount, unmount remotes |
|
| sshfs, fusermount(3) | optional | mount, unmount remotes |
|
||||||
|
|
17
src/nnn.c
17
src/nnn.c
|
@ -1278,7 +1278,7 @@ static bool xdiraccess(const char *path)
|
||||||
static void opstr(char *buf, char *op)
|
static void opstr(char *buf, char *op)
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#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
|
#else
|
||||||
snprintf(buf, CMD_LEN_MAX, "cat %s | xargs -0 -o -%c {} %s {} .", g_selpath, REPLACE_STR, op);
|
snprintf(buf, CMD_LEN_MAX, "cat %s | xargs -0 -o -%c {} %s {} .", g_selpath, REPLACE_STR, op);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1286,12 +1286,17 @@ static void opstr(char *buf, char *op)
|
||||||
|
|
||||||
static void rmmulstr(char *buf)
|
static void rmmulstr(char *buf)
|
||||||
{
|
{
|
||||||
if (cfg.trash)
|
if (cfg.trash) {
|
||||||
snprintf(buf, CMD_LEN_MAX, "cat %s | xargs -0 trash-put", g_selpath);
|
|
||||||
else {
|
|
||||||
snprintf(buf, CMD_LEN_MAX,
|
snprintf(buf, CMD_LEN_MAX,
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
"cat %s | xargs -0 rm -%cr", g_selpath, confirm_force(TRUE));
|
"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__
|
||||||
|
"xargs -0 -a %s rm -%cr", g_selpath, confirm_force(TRUE));
|
||||||
#else
|
#else
|
||||||
"cat %s | xargs -0 -o rm -%cr", g_selpath, confirm_force(TRUE));
|
"cat %s | xargs -0 -o rm -%cr", g_selpath, confirm_force(TRUE));
|
||||||
#endif
|
#endif
|
||||||
|
@ -1330,7 +1335,7 @@ static bool cpmv_rename(int choice, const char *path)
|
||||||
bool ret = FALSE;
|
bool ret = FALSE;
|
||||||
char *cmd = (choice == 'c' ? cp : mv);
|
char *cmd = (choice == 'c' ? cp : mv);
|
||||||
static const char formatcmd[] = "sed -i 's|^\\(\\(.*/\\)\\(.*\\)$\\)|#\\1\\n\\3|' %s";
|
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)];
|
char buf[sizeof(renamecmd) + sizeof(cmd) + (PATH_MAX << 1)];
|
||||||
|
|
||||||
fd = create_tmp_file();
|
fd = create_tmp_file();
|
||||||
|
|
Loading…
Reference in a new issue