mirror of https://github.com/jarun/nnn.git
Simplify functions
This commit is contained in:
parent
269b80dbb2
commit
43c636d95c
21
src/nnn.c
21
src/nnn.c
|
@ -1239,23 +1239,12 @@ static bool xdiraccess(const char *path)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cpstr(char *buf)
|
static void opstr(char *buf, char *op)
|
||||||
{
|
{
|
||||||
snprintf(buf, CMD_LEN_MAX,
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
"xargs -0 -a %s -%c {} %s {} .", g_selpath, REPLACE_STR, cp);
|
snprintf(buf, CMD_LEN_MAX, "xargs -0 -a %s -%c {} %s {} .", g_selpath, REPLACE_STR, op);
|
||||||
#else
|
#else
|
||||||
"cat %s | xargs -0 -o -%c {} %s {} .", g_selpath, REPLACE_STR, cp);
|
snprintf(buf, CMD_LEN_MAX, "cat %s | xargs -0 -o -%c {} %s {} .", g_selpath, REPLACE_STR, op);
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static void mvstr(char *buf)
|
|
||||||
{
|
|
||||||
snprintf(buf, CMD_LEN_MAX,
|
|
||||||
#ifdef __linux__
|
|
||||||
"xargs -0 -a %s -%c {} %s {} .", g_selpath, REPLACE_STR, mv);
|
|
||||||
#else
|
|
||||||
"cat %s | xargs -0 -o -%c {} %s {} .", g_selpath, REPLACE_STR, mv);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4404,10 +4393,10 @@ nochange:
|
||||||
|
|
||||||
switch (sel) {
|
switch (sel) {
|
||||||
case SEL_CP:
|
case SEL_CP:
|
||||||
cpstr(g_buf);
|
opstr(g_buf, cp);
|
||||||
break;
|
break;
|
||||||
case SEL_MV:
|
case SEL_MV:
|
||||||
mvstr(g_buf);
|
opstr(g_buf, mv);
|
||||||
break;
|
break;
|
||||||
case SEL_CPAS:
|
case SEL_CPAS:
|
||||||
if (!cpmv_rename(path, cp)) {
|
if (!cpmv_rename(path, cp)) {
|
||||||
|
|
Loading…
Reference in New Issue