summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2022-10-03 11:14:16 +0200
committerdefault <nobody@localhost>2022-10-03 11:14:16 +0200
commit7414b000ee273e40a335d868e27dd05b7de5e80e (patch)
tree813cf3037dff1c958d9e1fe2a93098f8903f4c85 /data.c
parent36a46f3996042b28ebb317e3bf808bf4dc260f6a (diff)
Use xs_glob() in history_list().
Diffstat (limited to 'data.c')
-rw-r--r--data.c27
1 files changed, 2 insertions, 25 deletions
diff --git a/data.c b/data.c
index 6b87a90..5e0ea66 100644
--- a/data.c
+++ b/data.c
@@ -912,32 +912,9 @@ int history_del(snac *snac, char *id)
d_char *history_list(snac *snac)
{
- d_char *list;
- xs *spec;
- glob_t globbuf;
-
- list = xs_list_new();
- spec = xs_fmt("%s/history/" "*.html", snac->basedir);
-
- if (glob(spec, 0, NULL, &globbuf) == 0) {
- int n;
- char *fn;
-
- for (n = 0; (fn = globbuf.gl_pathv[n]) != NULL; n++) {
- char *p;
-
- if ((p = strrchr(fn, '/')) != NULL) {
- *p++ = '\0';
+ xs *spec = xs_fmt("%s/history/" "*.html", snac->basedir);
- if (*p != '_')
- list = xs_list_append(list, p);
- }
- }
- }
-
- globfree(&globbuf);
-
- return list;
+ return xs_glob(spec, 1, 0);
}