diff options
author | Kamil Dudka <kdudka@redhat.com> | 2008-10-03 11:03:40 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2008-10-03 11:59:17 +0200 |
commit | e505736f8211a608b00dfe75fb186a5211e1a183 (patch) | |
tree | d5d0e1cb62e0148acf9b0cb11585d999b61d259c /src/sort.c | |
parent | 7eb15e1020590ebc1f39e5679feea8f1106d241c (diff) | |
download | coreutils-e505736f8211a608b00dfe75fb186a5211e1a183.tar.xz |
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.
Diffstat (limited to 'src/sort.c')
-rw-r--r-- | src/sort.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/sort.c b/src/sort.c index 44bfbe075..43c28fc84 100644 --- a/src/sort.c +++ b/src/sort.c @@ -29,6 +29,7 @@ #include "system.h" #include "argmatch.h" #include "error.h" +#include "filevercmp.h" #include "hard-locale.h" #include "hash.h" #include "md5.h" @@ -346,7 +347,7 @@ Ordering options:\n\ --sort=WORD sort according to WORD:\n\ general-numeric -g, month -M, numeric -n,\n\ random -R, version -V\n\ - -V, --version-sort sort by numeric version (see strverscmp(3))\n\ + -V, --version-sort sort by numeric version\n\ \n\ "), stdout); fputs (_("\ @@ -1823,7 +1824,7 @@ compare_random (char *restrict texta, size_t lena, } /* Compare the keys TEXTA (of length LENA) and TEXTB (of length LENB) - using strverscmp. */ + using filevercmp. See lib/filevercmp.h for function description. */ static int compare_version (char *restrict texta, size_t lena, @@ -1832,7 +1833,7 @@ compare_version (char *restrict texta, size_t lena, int diff; /* It is necessary to save the character after the end of the field. - "strverscmp" works with NUL terminated strings. Our blocks of + "filevercmp" works with NUL terminated strings. Our blocks of text are not necessarily terminated with a NUL byte. */ char sv_a = texta[lena]; char sv_b = textb[lenb]; @@ -1840,7 +1841,7 @@ compare_version (char *restrict texta, size_t lena, texta[lena] = '\0'; textb[lenb] = '\0'; - diff = strverscmp (texta, textb); + diff = filevercmp (texta, textb); texta[lena] = sv_a; textb[lenb] = sv_b; |