diff options
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 19 |
1 files changed, 19 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 | { |