diff options
author | default <nobody@localhost> | 2022-11-26 17:35:18 +0100 |
---|---|---|
committer | default <nobody@localhost> | 2022-11-26 17:35:18 +0100 |
commit | 4f261ec7b949b89146b699d04bd9e79ce87f7f10 (patch) | |
tree | 6256158f2b9ed7b3d679903befc4fdc3e3e55378 /data.c | |
parent | d03b988c9944c543ab5a8edacd03dfe30c595ba5 (diff) |
New function index_first().
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) } +int index_first(const char *fn, char *line, int size) +/* reads the first entry of an index */ +{ + FILE *f; + int ret = 0; + + if ((f = fopen(fn, "r")) != NULL) { + if (fgets(line, size, f) != NULL) { + line[32] = '\0'; + ret = 1; + } + + fclose(f); + } + + return ret; +} + + d_char *index_list(const char *fn, int max) /* returns an index as a list */ { |