/* fileset.c * Routines for handling file sets * * Wireshark - Network traffic analyzer * By Gerald Combs * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #include #ifdef HAVE_SYS_WAIT_H # include #endif #include #include #include #include #include #include #include #include #include "fileset.h" typedef struct _fileset { GList *entries; char *dirname; } fileset; /* * This is the fileset's global data. * * XXX This should probably be per-main-window instead of global. */ static fileset set = { NULL, NULL}; /* * Given a stat structure, get the creation time of the file if available, * or 0 if not. */ #ifdef _WIN32 /* Microsoft's documentation says this is the creation time */ #define ST_CREATE_TIME(statb) ((statb).st_ctime) #else /* _WIN32 */ /* UN*X - do we have a creation time? */ #if defined(HAVE_STRUCT_STAT_ST_BIRTHTIME) #define ST_CREATE_TIME(statb) ((statb).st_birthtime) #elif defined(HAVE_STRUCT_STAT___ST_BIRTHTIME) #define ST_CREATE_TIME(statb) ((statb).__st_birthtime) #else /* nothing */ #define ST_CREATE_TIME(statb) (0) #endif /* creation time on UN*X */ #endif /* _WIN32 */ /* is this a probable file of a file set (does the naming pattern match)? */ fileset_match_t fileset_filename_match_pattern(const char *fname, char **prefix, char **suffix, char **time) { char *sfx; char *filename; fileset_match_t ret = FILESET_NO_MATCH; static char *pattern = "(?P.*)_\\d{5}_(?P