mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-15 01:55:03 +00:00
New function index_first().
This commit is contained in:
parent
d03b988c99
commit
4f261ec7b9
2 changed files with 20 additions and 0 deletions
19
data.c
19
data.c
|
@ -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)
|
d_char *index_list(const char *fn, int max)
|
||||||
/* returns an index as a list */
|
/* returns an index as a list */
|
||||||
{
|
{
|
||||||
|
|
1
snac.h
1
snac.h
|
@ -55,6 +55,7 @@ double mtime_nl(const char *fn, int *n_link);
|
||||||
|
|
||||||
int index_add(const char *fn, const char *md5);
|
int index_add(const char *fn, const char *md5);
|
||||||
int index_del(const char *fn, const char *md5);
|
int index_del(const char *fn, const char *md5);
|
||||||
|
int index_first(const char *fn, char *buf, int size);
|
||||||
d_char *index_list(const char *fn, int max);
|
d_char *index_list(const char *fn, int max);
|
||||||
d_char *index_list_desc(const char *fn, int max);
|
d_char *index_list_desc(const char *fn, int max);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue