+2009-03-05 Kamil Dudka <kdudka@redhat.com>
+
+ * lib/filevercmp.c: Move hidden files up in ordering.
+ * tests/test-filevercmp.c: Add tests for hidden files.
+
2009-03-04 Bruno Haible <bruno@clisp.org>
* modules/visibility (Makefile.am): Augment AM_CFLAGS.
Date Modules Changes
+2009-03-05 filevercmp Move hidden files up in ordering.
+
2009-01-22 c-strtod This function no longer calls xalloc_die(). If
c-strtold you want to exit the program in case of out-of-
memory, the calling function needs to arrange
int
filevercmp (const char *s1, const char *s2)
{
- const char *s1_pos = s1;
- const char *s2_pos = s2;
+ const char *s1_pos;
+ const char *s2_pos;
const char *s1_suffix, *s2_suffix;
size_t s1_len, s2_len;
int result;
if (simple_cmp == 0)
return 0;
+ /* handle hidden files */
+ while (*s1 == '.' || *s2 == '.')
+ {
+ if (*s1 != *s2)
+ return *s1 - *s2;
+ s1++;
+ s2++;
+ }
+
/* "cut" file suffixes */
+ s1_pos = s1;
+ s2_pos = s2;
s1_suffix = match_suffix (&s1_pos);
s2_suffix = match_suffix (&s2_pos);
s1_len = (s1_suffix ? s1_suffix : s1_pos) - s1;
/* set of well sorted examples */
static const char *const examples[] =
{
+ ".",
+ "..",
+ ".a~",
+ ".a",
+ ".b~",
+ ".b",
+ "a~",
+ "a",
+ "b~",
+ "b",
"gcc-c++-10.fc9.tar.gz",
"gcc-c++-10.8.12-0.7rc2.fc9.tar.bz2",
"glibc-2-0.1.beta1.fc10.rpm",