aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-10-15 06:15:32 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-10-15 06:15:32 +0530
commit43c636d95c6ac835c1a92bcabe4297268fd41aa9 (patch)
treeab529b9e68178aa56887f515698aa61f0066b899
parent269b80dbb2ffdc64070b05f24e17ceacc667c092 (diff)
downloadnnn-43c636d95c6ac835c1a92bcabe4297268fd41aa9.tar.gz
Simplify functions
-rw-r--r--src/nnn.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 1c82b92..fbfc44d 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -1239,23 +1239,12 @@ static bool xdiraccess(const char *path)
return TRUE;
}
-static void cpstr(char *buf)
+static void opstr(char *buf, char *op)
{
- snprintf(buf, CMD_LEN_MAX,
-#ifdef __linux__
- "xargs -0 -a %s -%c {} %s {} .", g_selpath, REPLACE_STR, cp);
-#else
- "cat %s | xargs -0 -o -%c {} %s {} .", g_selpath, REPLACE_STR, cp);
-#endif
-}
-
-static void mvstr(char *buf)
-{
- snprintf(buf, CMD_LEN_MAX,
#ifdef __linux__
- "xargs -0 -a %s -%c {} %s {} .", g_selpath, REPLACE_STR, mv);
+ snprintf(buf, CMD_LEN_MAX, "xargs -0 -a %s -%c {} %s {} .", g_selpath, REPLACE_STR, op);
#else
- "cat %s | xargs -0 -o -%c {} %s {} .", g_selpath, REPLACE_STR, mv);
+ snprintf(buf, CMD_LEN_MAX, "cat %s | xargs -0 -o -%c {} %s {} .", g_selpath, REPLACE_STR, op);
#endif
}
@@ -4404,10 +4393,10 @@ nochange:
switch (sel) {
case SEL_CP:
- cpstr(g_buf);
+ opstr(g_buf, cp);
break;
case SEL_MV:
- mvstr(g_buf);
+ opstr(g_buf, mv);
break;
case SEL_CPAS:
if (!cpmv_rename(path, cp)) {