sort and output sorted_lines to window and free the lines */
| 738 | |
| 739 | /* sort and output sorted_lines to window and free the lines */ |
| 740 | staticfn void |
| 741 | disco_output_sorted( |
| 742 | winid tmpwin, |
| 743 | char **sorted_lines, int sorted_ct, |
| 744 | boolean lootsort) |
| 745 | { |
| 746 | char *p; |
| 747 | int j; |
| 748 | |
| 749 | qsort(sorted_lines, sorted_ct, sizeof (char *), discovered_cmp); |
| 750 | for (j = 0; j < sorted_ct; ++j) { |
| 751 | p = sorted_lines[j]; |
| 752 | assert(p != NULL); /* pacify static analyzer */ |
| 753 | if (lootsort) { |
| 754 | p[6] = p[0]; /* '*' or ' ' */ |
| 755 | p += 6; |
| 756 | } |
| 757 | putstr(tmpwin, 0, p); |
| 758 | free(sorted_lines[j]), sorted_lines[j] = 0; |
| 759 | } |
| 760 | } |
| 761 | |
| 762 | /* the #known command - show discovered object types */ |
| 763 | int |