summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2022-10-03 11:14:16 +0200
committerGravatar default2022-10-03 11:14:16 +0200
commit7414b000ee273e40a335d868e27dd05b7de5e80e (patch)
tree813cf3037dff1c958d9e1fe2a93098f8903f4c85
parentRenamed cached file _timeline.html to timeline.html_ to exclude it from globs. (diff)
downloadpenes-snac2-7414b000ee273e40a335d868e27dd05b7de5e80e.tar.gz
penes-snac2-7414b000ee273e40a335d868e27dd05b7de5e80e.tar.xz
penes-snac2-7414b000ee273e40a335d868e27dd05b7de5e80e.zip
Use xs_glob() in history_list().
-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)
912 912
913d_char *history_list(snac *snac) 913d_char *history_list(snac *snac)
914{ 914{
915 d_char *list; 915 xs *spec = xs_fmt("%s/history/" "*.html", snac->basedir);
916 xs *spec;
917 glob_t globbuf;
918
919 list = xs_list_new();
920 spec = xs_fmt("%s/history/" "*.html", snac->basedir);
921
922 if (glob(spec, 0, NULL, &globbuf) == 0) {
923 int n;
924 char *fn;
925
926 for (n = 0; (fn = globbuf.gl_pathv[n]) != NULL; n++) {
927 char *p;
928
929 if ((p = strrchr(fn, '/')) != NULL) {
930 *p++ = '\0';
931 916
932 if (*p != '_') 917 return xs_glob(spec, 1, 0);
933 list = xs_list_append(list, p);
934 }
935 }
936 }
937
938 globfree(&globbuf);
939
940 return list;
941} 918}
942 919
943 920