* lib/filevercmp.c: Handle simple~ and numbered.~3~ backup suffixes.
* tests/test-filevercmp.c: Add tests for backup suffixes.
Reported by Sven Joachim.
+2009-03-24 Kamil Dudka <kdudka@redhat.com>
+
+ filevercmp: handle simple~ and numbered.~3~ backup suffixes
+ * lib/filevercmp.c: Handle simple~ and numbered.~3~ backup suffixes.
+ * tests/test-filevercmp.c: Add tests for backup suffixes.
+
2009-03-24 Simon Josefsson <simon@josefsson.org>
* modules/stdlib (Depends-on): Add stdint, needed when defining
/*
Copyright (C) 1995 Ian Jackson <iwj10@cus.cam.ac.uk>
Copyright (C) 2001 Anthony Towns <aj@azure.humbug.org.au>
- Copyright (C) 2008 Free Software Foundation, Inc.
+ Copyright (C) 2008-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <limits.h>
/* Match a file suffix defined by this regular expression:
- /(\.[A-Za-z][A-Za-z0-9]*)*$/
+ /(\.[A-Za-z~][A-Za-z0-9~]*)*$/
Scan the string *STR and return a pointer to the matching suffix, or
NULL if not found. Upon return, *STR points to terminating NUL. */
static const char *
if (read_alpha)
{
read_alpha = false;
- if (!c_isalpha (**str))
+ if (!c_isalpha (**str) && '~' != **str)
match = NULL;
}
else if ('.' == **str)
if (!match)
match = *str;
}
- else if (!c_isalnum (**str))
+ else if (!c_isalnum (**str) && '~' != **str)
match = NULL;
(*str)++;
}
/*
Copyright (C) 1995 Ian Jackson <iwj10@cus.cam.ac.uk>
Copyright (C) 2001 Anthony Towns <aj@azure.humbug.org.au>
- Copyright (C) 2008 Free Software Foundation, Inc.
+ Copyright (C) 2008-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
It returns number >0 for S1 > S2, 0 for S1 == S2 and number <0 for S1 < S2.
This function compares strings, in a way that if VER1 and VER2 are version
- numbers and PREFIX and SUFFIX (SUFFIX defined as (\.[A-Za-z][A-Za-z0-9]*)*)
+ numbers and PREFIX and SUFFIX (SUFFIX defined as (\.[A-Za-z~][A-Za-z0-9~]*)*)
are strings then VER1 < VER2 implies filevercmp (PREFIX VER1 SUFFIX,
PREFIX VER2 SUFFIX) < 0.
/* Test of filevercmp() function.
- Copyright (C) 2008 Free Software Foundation, Inc.
+ Copyright (C) 2008-2009 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
".b",
"a~",
"a",
+ "a.b~",
+ "a.b",
+ "a.bc~",
+ "a.bc",
"b~",
"b",
"gcc-c++-10.fc9.tar.gz",
+ "gcc-c++-10.fc9.tar.gz.~1~",
+ "gcc-c++-10.fc9.tar.gz.~2~",
"gcc-c++-10.8.12-0.7rc2.fc9.tar.bz2",
+ "gcc-c++-10.8.12-0.7rc2.fc9.tar.bz2.~1~",
"glibc-2-0.1.beta1.fc10.rpm",
"glibc-common-5-0.2.beta2.fc9.ebuild",
"glibc-common-5-0.2b.deb",