In the last episode (Feb 15), Ulrich Spoerlein said: > Peter Jeremy wrote: > >>Is there a chance this might get included into libc? Or is it > >>considered bloat? > >I don't think it belongs in libc. Maybe libutil. > > This would require patching the gqview configure script, but I can live > with that. > > >For the first point, consider > > strverscmp("jan25", "janx25"); > > This fell victim to a rearranging of the while loop. Thanks for > pointing that out! > > Attached is an updated version, which now also takes leading zeros > into account. It still differs from the GNU version, because > strverscmp("foo.009", "foo.0") > 0 In my book, '009' is just greater > than zero, no matter what. If someone could explain to me, why the > GNU folks do it the other way round, I could try implementing that > too.
This looks a lot like strnatcmp, which is "natural sort" or "do what I mean" sort :) http://sourcefrog.net/projects/natsort/ Your function is simpler than the C implementation on that site, but falls over when a run of numbers exceeds 2^31 (raise it to 2^64 if you use strtoull, but that's as high as you can yet). -- Dan Nelson [EMAIL PROTECTED] _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"