commit 1675127

default  ·  2024-11-05 15:48:11 +0000 UTC
parent e194fa9
Minor xs tweak.
3 files changed,  +7, -5
+5, -4
 1@@ -4,21 +4,22 @@
 2 
 3 #define _XS_GLOB_H
 4 
 5-xs_list *xs_glob_n(const char *spec, int basename, int reverse, int max);
 6-#define xs_glob(spec, basename, reverse) xs_glob_n(spec, basename, reverse, XS_ALL)
 7+xs_list *xs_glob_n(const char *spec, int basename, int reverse, int mark, int max);
 8+#define xs_glob(spec, basename, reverse) xs_glob_n(spec, basename, reverse, 0, XS_ALL)
 9+#define xs_glob_m(spec, basename, reverse) xs_glob_n(spec, basename, reverse, 1, XS_ALL)
10 
11 
12 #ifdef XS_IMPLEMENTATION
13 
14 #include <glob.h>
15 
16-xs_list *xs_glob_n(const char *spec, int basename, int reverse, int max)
17+xs_list *xs_glob_n(const char *spec, int basename, int reverse, int mark, int max)
18 /* does a globbing and returns the found files */
19 {
20     glob_t globbuf;
21     xs_list *list = xs_list_new();
22 
23-    if (glob(spec, 0, NULL, &globbuf) == 0) {
24+    if (glob(spec, mark ? GLOB_MARK : 0, NULL, &globbuf) == 0) {
25         int n;
26 
27         if (max > (int) globbuf.gl_pathc)
+1, -0
1@@ -9,6 +9,7 @@
2 xs_str *xs_str_time(time_t t, const char *fmt, int local);
3 #define xs_str_localtime(t, fmt) xs_str_time(t, fmt, 1)
4 #define xs_str_utctime(t, fmt)   xs_str_time(t, fmt, 0)
5+#define xs_str_iso_date(t) xs_str_time(t, "%Y-%m-%dT%H:%M:%SZ", 0)
6 time_t xs_parse_iso_date(const char *iso_date, int local);
7 time_t xs_parse_time(const char *str, const char *fmt, int local);
8 #define xs_parse_localtime(str, fmt) xs_parse_time(str, fmt, 1)
+1, -1
1@@ -1 +1 @@
2-/* ae3126a2d093c6bb5c36328e27bc93a452aff379 2024-09-20T07:39:32+02:00 */
3+/* 35997d2dbc505320a62d3130daa95f638be8bb26 2024-11-05T16:47:36+01:00 */