mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
Fix #728
This commit is contained in:
parent
56dec17840
commit
56621705e8
18
src/nnn.c
18
src/nnn.c
|
@ -179,6 +179,12 @@
|
|||
#define CTX_MAX 8
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define SED "gsed"
|
||||
#else
|
||||
#define SED "sed"
|
||||
#endif
|
||||
|
||||
#define MIN_DISPLAY_COLS ((CTX_MAX * 2) + 2) /* Two chars for [ and ] */
|
||||
#define LONG_SIZE sizeof(ulong)
|
||||
#define ARCHIVE_CMD_LEN 16
|
||||
|
@ -671,11 +677,11 @@ static const char * const toks[] = {
|
|||
#define P_REPLACE 3
|
||||
|
||||
static const char * const patterns[] = {
|
||||
"sed -i 's|^\\(\\(.*/\\)\\(.*\\)$\\)|#\\1\\n\\3|' %s",
|
||||
"sed 's|^\\([^#/][^/]\\?.*\\)$|%s/\\1|;s|^#\\(/.*\\)$|\\1|' "
|
||||
SED" -i 's|^\\(\\(.*/\\)\\(.*\\)$\\)|#\\1\\n\\3|' %s",
|
||||
SED" 's|^\\([^#/][^/]\\?.*\\)$|%s/\\1|;s|^#\\(/.*\\)$|\\1|' "
|
||||
"%s | tr '\\n' '\\0' | xargs -0 -n2 sh -c '%s \"$0\" \"$@\" < /dev/tty'",
|
||||
"\\.(bz|bz2|gz|tar|taz|tbz|tbz2|tgz|z|zip)$",
|
||||
"sed -i 's|^%s\\(.*\\)$|%s\\1|' %s",
|
||||
SED" -i 's|^%s\\(.*\\)$|%s\\1|' %s",
|
||||
};
|
||||
|
||||
/* Colors */
|
||||
|
@ -2141,7 +2147,7 @@ static bool batch_rename(void)
|
|||
uint count = 0, lines = 0;
|
||||
bool dir = FALSE, ret = FALSE;
|
||||
char foriginal[TMP_LEN_MAX] = {0};
|
||||
static const char batchrenamecmd[] = "paste -d'\n' %s %s | sed 'N; /^\\(.*\\)\\n\\1$/!p;d' | "
|
||||
static const char batchrenamecmd[] = "paste -d'\n' %s %s | "SED" 'N; /^\\(.*\\)\\n\\1$/!p;d' | "
|
||||
"tr '\n' '\\0' | xargs -0 -n2 mv 2>/dev/null";
|
||||
char buf[sizeof(batchrenamecmd) + (PATH_MAX << 1)];
|
||||
int i = get_cur_or_sel();
|
||||
|
@ -2239,9 +2245,9 @@ static void archive_selection(const char *cmd, const char *archive, const char *
|
|||
|
||||
snprintf(buf, CMD_LEN_MAX,
|
||||
#ifdef __linux__
|
||||
"sed -ze 's|^%s/||' '%s' | xargs -0 %s %s", curpath, selpath, cmd, archive
|
||||
SED" -ze 's|^%s/||' '%s' | xargs -0 %s %s", curpath, selpath, cmd, archive
|
||||
#else
|
||||
"tr '\\0' '\n' < '%s' | sed -e 's|^%s/||' | tr '\n' '\\0' | xargs -0 %s %s",
|
||||
"tr '\\0' '\n' < '%s' | "SED" -e 's|^%s/||' | tr '\n' '\\0' | xargs -0 %s %s",
|
||||
selpath, curpath, cmd, archive
|
||||
#endif
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue