fix the sort order problem on cndump
This commit is contained in:
parent
174680e764
commit
89c3619ff6
12
src/cndump.c
12
src/cndump.c
@ -399,6 +399,18 @@ int main(int argc, char *argv[]) {
|
|||||||
else if (sort_mode == SORT_CATEGORY) {
|
else if (sort_mode == SORT_CATEGORY) {
|
||||||
qsort(entries, entry_count, sizeof(Entry), compare_by_category);
|
qsort(entries, entry_count, sizeof(Entry), compare_by_category);
|
||||||
}
|
}
|
||||||
|
else if (g_sort_order == 1) {
|
||||||
|
/* No sort mode but -r specified: reverse the natural order */
|
||||||
|
int left = 0;
|
||||||
|
int right = entry_count - 1;
|
||||||
|
while (left < right) {
|
||||||
|
Entry temp = entries[left];
|
||||||
|
entries[left] = entries[right];
|
||||||
|
entries[right] = temp;
|
||||||
|
left++;
|
||||||
|
right--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Calculate dynamic text width based on terminal */
|
/* Calculate dynamic text width based on terminal */
|
||||||
g_text_width = calc_text_width(get_terminal_width());
|
g_text_width = calc_text_width(get_terminal_width());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user