]> Sergey Matveev's repositories - nnn.git/commitdiff
Remove unnecessary parameter from `archive_selection()`
authorKlzXS <klzx+github@klzx.cf>
Mon, 12 Dec 2022 15:11:55 +0000 (16:11 +0100)
committerKlzXS <klzx+github@klzx.cf>
Mon, 12 Dec 2022 15:13:35 +0000 (16:13 +0100)
src/nnn.c

index ec33aea0fed8938abe611c628e06e6f9203afc5e..a5a8d770bb6a204cd9c02efad2cdb61ddca0db30 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -763,7 +763,7 @@ static const char * const patterns[] = {
                "%s | tr '\\n' '\\0' | xargs -0 -n2 sh -c '%s \"$0\" \"$@\" < /dev/tty'",
        "\\.(bz|bz2|gz|tar|taz|tbz|tbz2|tgz|z|zip)$", /* Basic formats that don't need external tools */
        SED" -i 's|^%s\\(.*\\)$|%s\\1|' %s",
-       SED" -ze 's|^%s/||' '%s' | xargs -0 %s %s",
+       "xargs -0 %s %s < '%s'",
 };
 
 /* Colors */
@@ -2746,17 +2746,17 @@ static char *get_archive_cmd(const char *archive)
        return archive_cmd[i];
 }
 
-static void archive_selection(const char *cmd, const char *archive, const char *curpath)
+static void archive_selection(const char *cmd, const char *archive)
 {
        char *buf = malloc((xstrlen(patterns[P_ARCHIVE_CMD]) + xstrlen(cmd) + xstrlen(archive)
-                          + xstrlen(curpath) + xstrlen(selpath)) * sizeof(char));
+                          + xstrlen(selpath)) * sizeof(char));
        if (!buf) {
                DPRINTF_S(strerror(errno));
                printwarn(NULL);
                return;
        }
 
-       snprintf(buf, CMD_LEN_MAX, patterns[P_ARCHIVE_CMD], curpath, selpath, cmd, archive);
+       snprintf(buf, CMD_LEN_MAX, patterns[P_ARCHIVE_CMD], cmd, archive, selpath);
        spawn(utils[UTIL_SH_EXEC], buf, NULL, NULL, F_CLI | F_CONFIRM);
        free(buf);
 }
@@ -7641,7 +7641,7 @@ nochange:
                                        }
                                }
 
-                               (r == 's') ? archive_selection(get_archive_cmd(tmp), tmp, "/")
+                               (r == 's') ? archive_selection(get_archive_cmd(tmp), tmp)
                                           : spawn(get_archive_cmd(tmp), tmp, pdents[cur].name,
                                                   NULL, F_CLI | F_CONFIRM);