summaryrefslogtreecommitdiff
path: root/lib/filevercmp.c
diff options
context:
space:
mode:
authorKamil Dudka <kdudka@redhat.com>2009-03-20 11:20:12 +0100
committerJim Meyering <meyering@redhat.com>2009-03-24 21:46:37 +0100
commit1721cf06d9f23949a7a2ed6aec7615f8f5731be4 (patch)
treed54eceea892841f63a96976b5c346b9cdfb29092 /lib/filevercmp.c
parent99856e7f178837dc447a9931e6c86242f632fc06 (diff)
downloadgnulib-1721cf06d9f23949a7a2ed6aec7615f8f5731be4.tar.gz
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. Reported by Sven Joachim.
Diffstat (limited to 'lib/filevercmp.c')
-rw-r--r--lib/filevercmp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/filevercmp.c b/lib/filevercmp.c
index 7b40c98f7b..99c07db9cc 100644
--- a/lib/filevercmp.c
+++ b/lib/filevercmp.c
@@ -1,7 +1,7 @@
/*
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
@@ -27,7 +27,7 @@
#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 *
@@ -40,7 +40,7 @@ match_suffix (const char **str)
if (read_alpha)
{
read_alpha = false;
- if (!c_isalpha (**str))
+ if (!c_isalpha (**str) && '~' != **str)
match = NULL;
}
else if ('.' == **str)
@@ -49,7 +49,7 @@ match_suffix (const char **str)
if (!match)
match = *str;
}
- else if (!c_isalnum (**str))
+ else if (!c_isalnum (**str) && '~' != **str)
match = NULL;
(*str)++;
}