summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2022-09-20 12:56:21 +0200
committerGravatar default2022-09-20 12:56:21 +0200
commit7cc26cfb392d67e61fcf3d6fb7a40608b671aa6b (patch)
tree0d455e0b4d0d36af8812563d8e0732f568b10b5d
parentNew function dequeue(). (diff)
downloadpenes-snac2-7cc26cfb392d67e61fcf3d6fb7a40608b671aa6b.tar.gz
penes-snac2-7cc26cfb392d67e61fcf3d6fb7a40608b671aa6b.tar.xz
penes-snac2-7cc26cfb392d67e61fcf3d6fb7a40608b671aa6b.zip
Changed some glob() oddities.
Diffstat (limited to '')
-rw-r--r--data.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/data.c b/data.c
index 0c0d6a2..8a345bc 100644
--- a/data.c
+++ b/data.c
@@ -8,7 +8,9 @@
8 8
9#include "snac.h" 9#include "snac.h"
10 10
11#include <time.h>
11#include <glob.h> 12#include <glob.h>
13#include <sys/stat.h>
12 14
13 15
14int srv_open(char *basedir) 16int srv_open(char *basedir)
@@ -277,7 +279,7 @@ d_char *_timeline_find_fn(snac *snac, char *id)
277 glob_t globbuf; 279 glob_t globbuf;
278 d_char *fn = NULL; 280 d_char *fn = NULL;
279 281
280 if (glob(spec, 0, NULL, &globbuf) == 0 && globbuf.gl_matchc) { 282 if (glob(spec, 0, NULL, &globbuf) == 0 && globbuf.gl_pathc) {
281 /* get just the first file */ 283 /* get just the first file */
282 fn = xs_str_new(globbuf.gl_pathv[0]); 284 fn = xs_str_new(globbuf.gl_pathv[0]);
283 } 285 }
@@ -363,11 +365,11 @@ d_char *timeline_list(snac *snac)
363 if (glob(spec, 0, NULL, &globbuf) == 0) { 365 if (glob(spec, 0, NULL, &globbuf) == 0) {
364 int n; 366 int n;
365 367
366 if (max > globbuf.gl_matchc) 368 if (max > globbuf.gl_pathc)
367 max = globbuf.gl_matchc; 369 max = globbuf.gl_pathc;
368 370
369 for (n = 0; n < max; n++) { 371 for (n = 0; n < max; n++) {
370 char *fn = globbuf.gl_pathv[globbuf.gl_matchc - n - 1]; 372 char *fn = globbuf.gl_pathv[globbuf.gl_pathc - n - 1];
371 373
372 list = xs_list_append(list, fn); 374 list = xs_list_append(list, fn);
373 } 375 }