We're going to call this repeatedly inside a loop; and it runs through a bunch of strcmp()s to discover sort_type each time round.
There may be some value in having the code that extracts sort_type from finalargs->next call an <code>
enum { LEX, WHOLE, FLOATING, IP, MAC } ParseSortType(const char* sort_type) { ... } </code>
once and then have this function take the enum, instead of a string, so that it can simply switch (sort_type) nice and efficiently.