L.S.
Here are patches for FreeBSD's ls (from version 3.3 release) and
OpenBSD's ls (version 2.6, didn't actually test this obsd patch as I'm
working on a FreeBSD machine at the moment).
What it does is add an option (yes another one) to sort alpha & numeric
separately, i.e. instead of something like
gsi-0.9.3p1.tgz
gsi-0.9.3p10.tgz
gsi-0.9.3p11.tgz
gsi-0.9.3p12.tgz
gsi-0.9.3p13.tgz
gsi-0.9.3p14.tgz
gsi-0.9.3p15.tgz
gsi-0.9.3p16.tgz
gsi-0.9.3p17.tgz
gsi-0.9.3p18.tgz
gsi-0.9.3p2.tgz
gsi-0.9.3p3.tgz
gsi-0.9.3p4.tgz
gsi-0.9.3p5.tgz
gsi-0.9.3p6.tgz
gsi-0.9.3p7.tgz
gsi-0.9.3p8.tgz
gsi-0.9.3p9.tgz
you will get:
gsi-0.9.3p1.tgz
gsi-0.9.3p2.tgz
gsi-0.9.3p3.tgz
gsi-0.9.3p4.tgz
gsi-0.9.3p5.tgz
gsi-0.9.3p6.tgz
gsi-0.9.3p7.tgz
gsi-0.9.3p8.tgz
gsi-0.9.3p9.tgz
gsi-0.9.3p10.tgz
gsi-0.9.3p11.tgz
gsi-0.9.3p12.tgz
gsi-0.9.3p13.tgz
gsi-0.9.3p14.tgz
gsi-0.9.3p15.tgz
gsi-0.9.3p16.tgz
gsi-0.9.3p17.tgz
gsi-0.9.3p18.tgz
Much better! This would be great on ftp servers (trying to find the
latest tgz for a given package in a list of around 50 or more is a
nuisance with lexicographical ordering).
The sort option is invoked with -n on fbsd, -N on obsd (change as you
like...).
I've also attached a complete little test program with debug output etc.
The code could be improved by renaming some variables to longer names
(couldn't think of any good ones ;) and probably the implementation too
(haven't tried to optimize).
Enjoy,
Wouter
alpha_num_cmp.c.gz
whs_fbsd_ls.diff.gz
whs_obsd_ls.diff.gz