rewrite due to missing cases in old algorithm

This version also does not always match GNU strverscmp.
another rewrite in the style of strnum_cmp from bam_sort.c