Date: Sun, 15 Nov 1998 14:05:18 +0100 From: Wolfram Schneider <wosch@panke.de.freebsd.org> To: Dmitrij Tejblum <dima@tejblum.dnttm.rssi.ru> Cc: current@FreeBSD.ORG Subject: Re: sort option for find Message-ID: <19981115140518.A2166@panke.de.freebsd.org> In-Reply-To: <199811151125.OAA02022@tejblum.dnttm.rssi.ru>; from Dmitrij Tejblum on Sun, Nov 15, 1998 at 02:24:59PM %2B0300 References: <19981114205002.A27346@panke.de.freebsd.org> <199811151125.OAA02022@tejblum.dnttm.rssi.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
On 1998-11-15 14:24:59 +0300, Dmitrij Tejblum wrote: > > + * find_compare -- > > + * A function which be used in fts_open() to order the > > + * traversal of the hierarchy. > > + * This function give you a lexicographical sorted output. > > + */ > > +static int find_compare(s1, s2) > > + const FTSENT **s1, **s2; > > +{ > > + return strcoll( (*s1)->fts_name, (*s2)->fts_name ); > > +} > > That depends on what do you call "lexicographical order". How do you > compare "foo-1.2.3/Makefile" and "foo/Makefile", for example? (Anyhow, I compare the file "foo-1.2.3" with the file "foo" and "foo-1.2.3" is greater. The directory "foo" will be visited first. I don't sort the output - I change the order of the traversal of the file hierarchy. As a side effect, the output will be sorted on a per directory basis. Wolfram > strcoll is not supposed to compare in lexicographical order at all. > Most implementation don't give lexicographical sorting in non-C locale.). > > Dima > > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19981115140518.A2166>