utility: move dirs_count() to global header.
format: drop special sorting case for root path.
it is replaced by generic qsort sorting logic, which handles the
original case as well as allowing the possibility of having non-root
directories being setup at install time.
format/utility: replace sorting logic with simpler subtraction.
same logic as old expression but more compact.