]> Sergey Matveev's repositories - nnn.git/commitdiff
Revert "Replaced 'sed' with 'awk'"
authorArun Prakash Jana <engineerarun@gmail.com>
Wed, 14 Aug 2019 15:42:17 +0000 (21:12 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Wed, 14 Aug 2019 16:28:22 +0000 (21:58 +0530)
This reverts commit 1027cd0cf29a418e0d01f27a9e595c3fd516ec9a.

src/nnn.c

index 3c730d45be7813b8b570410414208aa7bdec87e3..109816a3e46fd4a97dfa7fe84310e05d3bb8af25 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -1302,7 +1302,12 @@ static void archive_selection(const char *cmd, const char *archive, const char *
 {
        char *buf = (char *)malloc(CMD_LEN_MAX * sizeof(char));
        snprintf(buf, CMD_LEN_MAX,
-               "awk 'BEGIN{RS=\"\\0\"} {gsub(\"%s/\", \"\", $0); printf \"%%s\\0\", $0}' %s | xargs -0 %s %s", curpath, g_cppath, cmd, archive);
+#ifdef __linux__
+               "sed -ze 's|^%s/||' '%s' | xargs -0 %s %s", curpath, g_cppath, cmd, archive);
+#else
+               "cat '%s' | tr '\\0' '\n' | sed -e 's|^%s/||' | tr '\n' '\\0' | xargs -0 %s %s",
+               g_cppath, curpath, cmd, archive);
+#endif
        spawn("sh", "-c", buf, curpath, F_NORMAL);
        free(buf);
 }