More updates:
The attached patch converts 'sort' and 'join' to use the key comparison 
functions in 'key-spec-parsing.c'.

Sort was straight-forward (as expected), mostly removing the duplicated code 
and moving some more functions to key-spec-parsing.c.

Join required a bit of trickery (explained in the code), the main change is the 
'keycmp()' function that now calls "keycompare()".

All tests pass for sort and join, but I suspect the join test-suite is not 
exhaustive.

Join definitely needs more testing, but one immediate feature is join in 
reverse order (which already works):
===
##
## Input files
##
$ cat j3.in 
C 1
B 2
A 3
$ cat j4.in 
C 9
A 8

##
## Existing join
##
$ join -a 1 -a 2 -o auto -e . -j1 j3.in j4.in 
C 1 9
A . 8
B 2 .
join: j3.in:3: is not sorted: A 3
A 3 .

##
## new Join reverse
##
$ ./src/join --reverse -a 1 -a 2 -o auto -e . -j1 j3.in j4.in 
C 1 9
B 2 .
A 3 8
===


Regards,
 -gordon

Attachment: uniq_key6.patch.xz
Description: application/xz

Reply via email to