From e505736f8211a608b00dfe75fb186a5211e1a183 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Fri, 3 Oct 2008 11:03:40 +0200 Subject: ls and sort: use filevercmp instead of strverscmp * src/ls.c (cmp_version): Use filevercmp instead of strverscmp. * src/sort.c (usage): Remove mna reference to strverscmp(3). (compare_version): Use filevercmp instead of strverscmp. * bootstrap.conf: Add filevercmp to list of gnulib modules. * tests/misc/sort-version: Remove conflicting string and enhance test. * NEWS: Mention the change. --- src/ls.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/ls.c') diff --git a/src/ls.c b/src/ls.c index aeece67dd..e107162ef 100644 --- a/src/ls.c +++ b/src/ls.c @@ -94,6 +94,7 @@ #include "hash.h" #include "human.h" #include "filemode.h" +#include "filevercmp.h" #include "idcache.h" #include "ls.h" #include "lstat.h" @@ -3123,8 +3124,9 @@ DEFINE_SORT_FUNCTIONS (extension, cmp_extension) /* Compare file versions. Unlike all other compare functions above, cmp_version depends only - on strverscmp, which does not fail (even for locale reasons), and does not - need a secondary sort key. + on filevercmp, which does not fail (even for locale reasons), and does not + need a secondary sort key. See lib/filevercmp.h for function description. + All the other sort options, in fact, need xstrcoll and strcmp variants, because they all use a string comparison (either as the primary or secondary sort key), and xstrcoll has the ability to do a longjmp if strcoll fails for @@ -3133,7 +3135,7 @@ DEFINE_SORT_FUNCTIONS (extension, cmp_extension) static inline int cmp_version (struct fileinfo const *a, struct fileinfo const *b) { - return strverscmp (a->name, b->name); + return filevercmp (a->name, b->name); } static int xstrcoll_version (V a, V b) -- cgit v1.2.3-54-g00ecf