From 9f153fbfec0fb9c9ce38e749a7c6f4a5e115d4e9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 19 Sep 2024 06:14:33 +0200 Subject: Merging upstream version 4.4.0. Signed-off-by: Daniel Baumann --- fileset.c | 205 +++++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 122 insertions(+), 83 deletions(-) (limited to 'fileset.c') diff --git a/fileset.c b/fileset.c index f137de3b..2a0b252b 100644 --- a/fileset.c +++ b/fileset.c @@ -23,6 +23,8 @@ #include #include +#include + #include #include "fileset.h" @@ -37,7 +39,7 @@ typedef struct _fileset { * * XXX This should probably be per-main-window instead of global. */ -static fileset set = { NULL, NULL}; +static fileset set; /* * Given a stat structure, get the creation time of the file if available, @@ -58,109 +60,146 @@ static fileset set = { NULL, NULL}; #endif /* _WIN32 */ /* is this a probable file of a file set (does the naming pattern match)? */ -gboolean -fileset_filename_match_pattern(const char *fname) +fileset_match_t +fileset_filename_match_pattern(const char *fname, char **prefix, char **suffix, char **time) { - char *pfx; - size_t baselen; - size_t minlen = strlen("_00001_20050418010750"); + char *sfx; char *filename; + fileset_match_t ret = FILESET_NO_MATCH; + static char *pattern = "(?P.*)_\\d{5}_(?P