Merge pull request #767 from takiz/transm_show

Add option "--unsorted" for transmission-show
This commit is contained in:
Charles Kerr 2019-02-01 22:09:37 -06:00 committed by GitHub
commit 322c30d991
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 2 deletions

View File

@ -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)
{