diff options
| -rw-r--r-- | data.c | 19 | ||||
| -rw-r--r-- | snac.h | 1 |
2 files changed, 20 insertions, 0 deletions
| @@ -306,6 +306,25 @@ int index_in(const char *fn, const char *id) | |||
| 306 | } | 306 | } |
| 307 | 307 | ||
| 308 | 308 | ||
| 309 | int index_first(const char *fn, char *line, int size) | ||
| 310 | /* reads the first entry of an index */ | ||
| 311 | { | ||
| 312 | FILE *f; | ||
| 313 | int ret = 0; | ||
| 314 | |||
| 315 | if ((f = fopen(fn, "r")) != NULL) { | ||
| 316 | if (fgets(line, size, f) != NULL) { | ||
| 317 | line[32] = '\0'; | ||
| 318 | ret = 1; | ||
| 319 | } | ||
| 320 | |||
| 321 | fclose(f); | ||
| 322 | } | ||
| 323 | |||
| 324 | return ret; | ||
| 325 | } | ||
| 326 | |||
| 327 | |||
| 309 | d_char *index_list(const char *fn, int max) | 328 | d_char *index_list(const char *fn, int max) |
| 310 | /* returns an index as a list */ | 329 | /* returns an index as a list */ |
| 311 | { | 330 | { |
| @@ -55,6 +55,7 @@ double mtime_nl(const char *fn, int *n_link); | |||
| 55 | 55 | ||
| 56 | int index_add(const char *fn, const char *md5); | 56 | int index_add(const char *fn, const char *md5); |
| 57 | int index_del(const char *fn, const char *md5); | 57 | int index_del(const char *fn, const char *md5); |
| 58 | int index_first(const char *fn, char *buf, int size); | ||
| 58 | d_char *index_list(const char *fn, int max); | 59 | d_char *index_list(const char *fn, int max); |
| 59 | d_char *index_list_desc(const char *fn, int max); | 60 | d_char *index_list_desc(const char *fn, int max); |
| 60 | 61 | ||