diff options
| author | 2024-11-05 16:48:11 +0100 | |
|---|---|---|
| committer | 2024-11-05 16:48:11 +0100 | |
| commit | 1675127c2a9d5e8e6fa1d3dd86a47a083d34bdb7 (patch) | |
| tree | fae2bb28fe38f09658d8478e0f3c7ab665c66185 | |
| parent | Merge branch 'master' of comam.es:git/snac2 (diff) | |
| download | penes-snac2-1675127c2a9d5e8e6fa1d3dd86a47a083d34bdb7.tar.gz penes-snac2-1675127c2a9d5e8e6fa1d3dd86a47a083d34bdb7.tar.xz penes-snac2-1675127c2a9d5e8e6fa1d3dd86a47a083d34bdb7.zip | |
Minor xs tweak.
| -rw-r--r-- | xs_glob.h | 9 | ||||
| -rw-r--r-- | xs_time.h | 1 | ||||
| -rw-r--r-- | xs_version.h | 2 |
3 files changed, 7 insertions, 5 deletions
| @@ -4,21 +4,22 @@ | |||
| 4 | 4 | ||
| 5 | #define _XS_GLOB_H | 5 | #define _XS_GLOB_H |
| 6 | 6 | ||
| 7 | xs_list *xs_glob_n(const char *spec, int basename, int reverse, int max); | 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, XS_ALL) | 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) | ||
| 9 | 10 | ||
| 10 | 11 | ||
| 11 | #ifdef XS_IMPLEMENTATION | 12 | #ifdef XS_IMPLEMENTATION |
| 12 | 13 | ||
| 13 | #include <glob.h> | 14 | #include <glob.h> |
| 14 | 15 | ||
| 15 | xs_list *xs_glob_n(const char *spec, int basename, int reverse, int max) | 16 | xs_list *xs_glob_n(const char *spec, int basename, int reverse, int mark, int max) |
| 16 | /* does a globbing and returns the found files */ | 17 | /* does a globbing and returns the found files */ |
| 17 | { | 18 | { |
| 18 | glob_t globbuf; | 19 | glob_t globbuf; |
| 19 | xs_list *list = xs_list_new(); | 20 | xs_list *list = xs_list_new(); |
| 20 | 21 | ||
| 21 | if (glob(spec, 0, NULL, &globbuf) == 0) { | 22 | if (glob(spec, mark ? GLOB_MARK : 0, NULL, &globbuf) == 0) { |
| 22 | int n; | 23 | int n; |
| 23 | 24 | ||
| 24 | if (max > (int) globbuf.gl_pathc) | 25 | if (max > (int) globbuf.gl_pathc) |
| @@ -9,6 +9,7 @@ | |||
| 9 | xs_str *xs_str_time(time_t t, const char *fmt, int local); | 9 | xs_str *xs_str_time(time_t t, const char *fmt, int local); |
| 10 | #define xs_str_localtime(t, fmt) xs_str_time(t, fmt, 1) | 10 | #define xs_str_localtime(t, fmt) xs_str_time(t, fmt, 1) |
| 11 | #define xs_str_utctime(t, fmt) xs_str_time(t, fmt, 0) | 11 | #define xs_str_utctime(t, fmt) xs_str_time(t, fmt, 0) |
| 12 | #define xs_str_iso_date(t) xs_str_time(t, "%Y-%m-%dT%H:%M:%SZ", 0) | ||
| 12 | time_t xs_parse_iso_date(const char *iso_date, int local); | 13 | time_t xs_parse_iso_date(const char *iso_date, int local); |
| 13 | time_t xs_parse_time(const char *str, const char *fmt, int local); | 14 | time_t xs_parse_time(const char *str, const char *fmt, int local); |
| 14 | #define xs_parse_localtime(str, fmt) xs_parse_time(str, fmt, 1) | 15 | #define xs_parse_localtime(str, fmt) xs_parse_time(str, fmt, 1) |
diff --git a/xs_version.h b/xs_version.h index 13aa7c6..84f7c5b 100644 --- a/xs_version.h +++ b/xs_version.h | |||
| @@ -1 +1 @@ | |||
| /* ae3126a2d093c6bb5c36328e27bc93a452aff379 2024-09-20T07:39:32+02:00 */ | /* 35997d2dbc505320a62d3130daa95f638be8bb26 2024-11-05T16:47:36+01:00 */ | ||