mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
Reformat get archive cmd
This commit is contained in:
parent
0d7d0ca7db
commit
edb9fe14e4
14
src/nnn.c
14
src/nnn.c
|
@ -1915,14 +1915,18 @@ finish:
|
||||||
|
|
||||||
static void get_archive_cmd(char *cmd, char *archive)
|
static void get_archive_cmd(char *cmd, char *archive)
|
||||||
{
|
{
|
||||||
|
uchar i = 3;
|
||||||
|
const char *arcmd[] = {"atool -a", "bsdtar -acvf", "zip -r", "tar -acvf"};
|
||||||
|
|
||||||
if (getutil(utils[UTIL_ATOOL]))
|
if (getutil(utils[UTIL_ATOOL]))
|
||||||
xstrlcpy(cmd, "atool -a", ARCHIVE_CMD_LEN);
|
i = 0;
|
||||||
else if (getutil(utils[UTIL_BSDTAR]))
|
else if (getutil(utils[UTIL_BSDTAR]))
|
||||||
xstrlcpy(cmd, "bsdtar -acvf", ARCHIVE_CMD_LEN);
|
i = 1;
|
||||||
else if (is_suffix(archive, ".zip"))
|
else if (is_suffix(archive, ".zip"))
|
||||||
xstrlcpy(cmd, "zip -r", ARCHIVE_CMD_LEN);
|
i = 2;
|
||||||
else
|
// else tar
|
||||||
xstrlcpy(cmd, "tar -acvf", ARCHIVE_CMD_LEN);
|
|
||||||
|
xstrlcpy(cmd, arcmd[i], ARCHIVE_CMD_LEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void archive_selection(const char *cmd, const char *archive, const char *curpath)
|
static void archive_selection(const char *cmd, const char *archive, const char *curpath)
|
||||||
|
|
Loading…
Reference in a new issue