summaryrefslogtreecommitdiff
path: root/xs_glob.h
diff options
context:
space:
mode:
authorGravatar default2024-11-05 16:48:11 +0100
committerGravatar default2024-11-05 16:48:11 +0100
commit1675127c2a9d5e8e6fa1d3dd86a47a083d34bdb7 (patch)
treefae2bb28fe38f09658d8478e0f3c7ab665c66185 /xs_glob.h
parentMerge branch 'master' of comam.es:git/snac2 (diff)
downloadpenes-snac2-1675127c2a9d5e8e6fa1d3dd86a47a083d34bdb7.tar.gz
penes-snac2-1675127c2a9d5e8e6fa1d3dd86a47a083d34bdb7.tar.xz
penes-snac2-1675127c2a9d5e8e6fa1d3dd86a47a083d34bdb7.zip
Minor xs tweak.
Diffstat (limited to 'xs_glob.h')
-rw-r--r--xs_glob.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/xs_glob.h b/xs_glob.h
index 24a6f56..15cb49a 100644
--- a/xs_glob.h
+++ b/xs_glob.h
@@ -4,21 +4,22 @@
4 4
5#define _XS_GLOB_H 5#define _XS_GLOB_H
6 6
7xs_list *xs_glob_n(const char *spec, int basename, int reverse, int max); 7xs_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
15xs_list *xs_glob_n(const char *spec, int basename, int reverse, int max) 16xs_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)