From ace4b870046587e8b7a8bcbf1d65e0d4003f9c6f Mon Sep 17 00:00:00 2001 From: Danny Auble <da@llnl.gov> Date: Tue, 1 Jul 2008 20:08:06 +0000 Subject: [PATCH] added better sorting --- src/sacctmgr/association_functions.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sacctmgr/association_functions.c b/src/sacctmgr/association_functions.c index 9f8eca2d0ba..91246770642 100644 --- a/src/sacctmgr/association_functions.c +++ b/src/sacctmgr/association_functions.c @@ -187,6 +187,7 @@ static int _set_cond(int *start, int argc, char *argv[], return set; } + /* * Comparator used for sorting immediate childern of local_assocs * @@ -196,15 +197,16 @@ static int _set_cond(int *start, int argc, char *argv[], static int _sort_childern_list(local_assoc_t *local_a, local_assoc_t *local_b) { - int diff = strcmp(local_a->sort_name, local_b->sort_name); + int diff = 0; /* check to see if this is a user association or an account. * We want the accounts at the bottom */ - if(list_count(local_a->childern) && list_count(local_a->childern)) + if(list_count(local_a->childern) && !list_count(local_b->childern)) return 1; else if(!list_count(local_a->childern) && list_count(local_b->childern)) return -1; + diff = strcmp(local_a->sort_name, local_b->sort_name); if (diff < 0) return -1; else if (diff > 0) -- GitLab