Fix iname sorting of directories

Used uninitialized buffers after resent clean up regarding trailing
slash.

Thanks to filterfalse.
Better code for opt_handlers:sort_handler()
Merge branch 'fix-sorting-after-slash-pruning'

Fix iname sorting of directories.  Used uninitialized buffers after
resent clean up regarding trailing slash.

Thanks to filterfalse.