From 21291d86092ff6f51be9c192bbfb7b23a02f913f Mon Sep 17 00:00:00 2001 From: takiz Date: Mon, 19 Nov 2018 15:35:32 +0500 Subject: [PATCH] Add option "--unsorted" for transmission-show --- utils/show.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/utils/show.c b/utils/show.c index 78bf661d7..1b667bf17 100644 --- a/utils/show.c +++ b/utils/show.c @@ -32,6 +32,7 @@ static tr_option options[] = { { 'm', "magnet", "Give a magnet link for the specified torrent", "m", 0, NULL }, { 's', "scrape", "Ask the torrent's trackers how many peers are in the torrent's swarm", "s", 0, NULL }, + { 'u', "unsorted", "Do not sort files by name", "u", 0, NULL }, { 'V', "version", "Show version number and exit", "V", 0, NULL }, { 0, NULL, NULL, NULL, 0, NULL } }; @@ -43,6 +44,7 @@ static char const* getUsage(void) static bool magnetFlag = false; static bool scrapeFlag = false; +static bool unsorted = false; static bool showVersion = false; char const* filename = NULL; @@ -63,6 +65,10 @@ static int parseCommandLine(int argc, char const* const* argv) scrapeFlag = true; break; + case 'u': + unsorted = true; + break; + case 'V': showVersion = true; break; @@ -188,8 +194,11 @@ static void showInfo(tr_info const* inf) { files[i] = &inf->files[i]; } - - qsort(files, inf->fileCount, sizeof(tr_file*), compare_files_by_name); + + if (!unsorted) + { + qsort(files, inf->fileCount, sizeof(tr_file*), compare_files_by_name); + } for (unsigned int i = 0; i < inf->fileCount; ++i) {