Browse Source

Minor xs tweak.

default 4 months ago
parent
commit
1675127c2a
3 changed files with 7 additions and 5 deletions
  1. 5 4
      xs_glob.h
  2. 1 0
      xs_time.h
  3. 1 1
      xs_version.h

+ 5 - 4
xs_glob.h

@@ -4,21 +4,22 @@
 
 #define _XS_GLOB_H
 
-xs_list *xs_glob_n(const char *spec, int basename, int reverse, int max);
-#define xs_glob(spec, basename, reverse) xs_glob_n(spec, basename, reverse, XS_ALL)
+xs_list *xs_glob_n(const char *spec, int basename, int reverse, int mark, int max);
+#define xs_glob(spec, basename, reverse) xs_glob_n(spec, basename, reverse, 0, XS_ALL)
+#define xs_glob_m(spec, basename, reverse) xs_glob_n(spec, basename, reverse, 1, XS_ALL)
 
 
 #ifdef XS_IMPLEMENTATION
 
 #include <glob.h>
 
-xs_list *xs_glob_n(const char *spec, int basename, int reverse, int max)
+xs_list *xs_glob_n(const char *spec, int basename, int reverse, int mark, int max)
 /* does a globbing and returns the found files */
 {
     glob_t globbuf;
     xs_list *list = xs_list_new();
 
-    if (glob(spec, 0, NULL, &globbuf) == 0) {
+    if (glob(spec, mark ? GLOB_MARK : 0, NULL, &globbuf) == 0) {
         int n;
 
         if (max > (int) globbuf.gl_pathc)

+ 1 - 0
xs_time.h

@@ -9,6 +9,7 @@
 xs_str *xs_str_time(time_t t, const char *fmt, int local);
 #define xs_str_localtime(t, fmt) xs_str_time(t, fmt, 1)
 #define xs_str_utctime(t, fmt)   xs_str_time(t, fmt, 0)
+#define xs_str_iso_date(t) xs_str_time(t, "%Y-%m-%dT%H:%M:%SZ", 0)
 time_t xs_parse_iso_date(const char *iso_date, int local);
 time_t xs_parse_time(const char *str, const char *fmt, int local);
 #define xs_parse_localtime(str, fmt) xs_parse_time(str, fmt, 1)

+ 1 - 1
xs_version.h

@@ -1 +1 @@
-/* ae3126a2d093c6bb5c36328e27bc93a452aff379 2024-09-20T07:39:32+02:00 */
+/* 35997d2dbc505320a62d3130daa95f638be8bb26 2024-11-05T16:47:36+01:00 */