Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Surprising behaviour with numeric glob sort
On Jun 3, 10:16pm, Stephane Chazelas wrote:
}
} When comparing "zsh-3" with "zsh2", we compare the non-numeric
} prefix: "zsh-" and "zsh". And already, at that point, "zsh" is
} less than "zsh-", so we stop here (zsh2 < zsh-3)
Explain how to do that without either re-implementing strcoll(),
copying the input strings into temporaries, or requiring the input
strings to be writable so that we can plug in temporary '\0' bytes
after each non-numeric substring, and at that point we can discuss
using this algorithm. Otherwise it's going to be unusuably slow
for any moderately large input set.
Otherwise you're describing what's already done: strcoll() is used,
and then the non-numeric prefixes of the two strings are compared,
and only if the non-numeric parts are identical is numeric comparison
applied. (Of course this is already slightly wrong, because it means
the non-numeric parts have to be *identical* not merely collated the
same, but to fix that we're back to "re-implement strcoll()".)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author