From 413b7afdbfe2907aed7762472ff2f8a498a31453 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 27 Aug 2022 01:21:38 -0500 Subject: [PATCH] Make all the tar tests look at archivers in the same order so people reading the code aren't confused by seemingly different tests. (This is the order they were historically added. Some were in alphabetical order but bzcat/xzcat/zcat vs bzip2/gzip/xz aren't consistent.) --- toys/posix/tar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toys/posix/tar.c b/toys/posix/tar.c index 9d57f30e..7893b259 100644 --- a/toys/posix/tar.c +++ b/toys/posix/tar.c @@ -880,7 +880,7 @@ static void do_XT(char **pline, long len) static char *get_archiver() { - return FLAG(I) ? TT.I : FLAG(z) ? "gzip" : FLAG(J) ? "xz" : "bzip2"; + return FLAG(I) ? TT.I : FLAG(z) ? "gzip" : FLAG(j) ? "bzip2" : "xz"; } void tar_main(void) @@ -980,7 +980,7 @@ void tar_main(void) if (FLAG(j)||FLAG(z)||FLAG(I)||FLAG(J)) { int pipefd[2] = {hdr ? -1 : TT.fd, -1}, i, pid; struct string_list *zcat = FLAG(I) ? 0 : find_in_path(getenv("PATH"), - FLAG(j) ? "bzcat" : FLAG(J) ? "xzcat" : "zcat"); + FLAG(z) ? "zcat" : FLAG(j) ? "bzcat" : "xzcat"); // Toybox provides more decompressors than compressors, so try them first TT.pid = xpopen_both(zcat ? (char *[]){zcat->str, 0} : -- 2.39.2