From owner-freebsd-current Sun Nov 15 08:02:43 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id IAA07453 for freebsd-current-outgoing; Sun, 15 Nov 1998 08:02:43 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from baerenklau.de.freebsd.org (baerenklau.de.freebsd.org [195.185.195.14]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id IAA07446 for ; Sun, 15 Nov 1998 08:02:41 -0800 (PST) (envelope-from wosch@panke.de.freebsd.org) Received: (from uucp@localhost) by baerenklau.de.freebsd.org (8.8.8/8.8.8) with UUCP id RAA10554; Sun, 15 Nov 1998 17:02:06 +0100 (CET) (envelope-from wosch@panke.de.freebsd.org) Received: (from wosch@localhost) by campa.panke.de.freebsd.org (8.8.8/8.8.8) id OAA02188; Sun, 15 Nov 1998 14:05:19 +0100 (MET) (envelope-from wosch) Message-ID: <19981115140518.A2166@panke.de.freebsd.org> Date: Sun, 15 Nov 1998 14:05:18 +0100 From: Wolfram Schneider To: Dmitrij Tejblum Cc: current@FreeBSD.ORG Subject: Re: sort option for find References: <19981114205002.A27346@panke.de.freebsd.org> <199811151125.OAA02022@tejblum.dnttm.rssi.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.93.1i In-Reply-To: <199811151125.OAA02022@tejblum.dnttm.rssi.ru>; from Dmitrij Tejblum on Sun, Nov 15, 1998 at 02:24:59PM +0300 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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