local: fix percent function. must have whole expression in ()'s
before the cast to int.
convert qsort callback into a  utility callback for char **