diff options
author | Arun Prakash Jana <engineerarun@gmail.com> | 2020-09-18 20:45:47 +0530 |
---|---|---|
committer | Arun Prakash Jana <engineerarun@gmail.com> | 2020-09-18 20:45:47 +0530 |
commit | 56621705e8c041e95ba2f2c70d5e7473964b4055 (patch) | |
tree | f9eb469fdea6e72b78c0d9e5403add3ed83f87fc /src | |
parent | 56dec17840c68a24e6734d0147db726e7be0bbfb (diff) | |
download | nnn-56621705e8c041e95ba2f2c70d5e7473964b4055.tar.gz |
Fix #728
Diffstat (limited to 'src')
-rw-r--r-- | src/nnn.c | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -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 ); |