mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-22 05:15:04 +00:00
Use xs_glob() in history_list().
This commit is contained in:
parent
36a46f3996
commit
7414b000ee
1 changed files with 2 additions and 25 deletions
27
data.c
27
data.c
|
@ -912,32 +912,9 @@ int history_del(snac *snac, char *id)
|
||||||
|
|
||||||
d_char *history_list(snac *snac)
|
d_char *history_list(snac *snac)
|
||||||
{
|
{
|
||||||
d_char *list;
|
xs *spec = xs_fmt("%s/history/" "*.html", snac->basedir);
|
||||||
xs *spec;
|
|
||||||
glob_t globbuf;
|
|
||||||
|
|
||||||
list = xs_list_new();
|
return xs_glob(spec, 1, 0);
|
||||||
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';
|
|
||||||
|
|
||||||
if (*p != '_')
|
|
||||||
list = xs_list_append(list, p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
globfree(&globbuf);
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue