Document add_one_entry_nis(), write_all(), commonio_remove(),

commonio_locate(), and commonio_rewind().
This commit is contained in:
nekral-guest 2008-01-01 20:34:47 +00:00
parent e700196c17
commit 6f45325d6e
2 changed files with 35 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2008-01-01 Nicolas François <nicolas.francois@centraliens.net>
* lib/commonio.c: Document add_one_entry_nis(), write_all(),
commonio_remove(), commonio_locate(), and commonio_rewind().
2008-01-01 Nicolas François <nicolas.francois@centraliens.net> 2008-01-01 Nicolas François <nicolas.francois@centraliens.net>
* src/pwck.c: Avoid implicit brackets. * src/pwck.c: Avoid implicit brackets.

View File

@ -395,6 +395,9 @@ static int name_is_nis (const char *n)
#if KEEP_NIS_AT_END #if KEEP_NIS_AT_END
static void add_one_entry_nis (struct commonio_db *, struct commonio_entry *); static void add_one_entry_nis (struct commonio_db *, struct commonio_entry *);
/*
* Insert an entry between the regular entries, and the NIS entries.
*/
static void static void
add_one_entry_nis (struct commonio_db *db, struct commonio_entry *newp) add_one_entry_nis (struct commonio_db *db, struct commonio_entry *newp)
{ {
@ -633,6 +636,11 @@ int commonio_sort_wrt (struct commonio_db *shadow, struct commonio_db *passwd)
return 0; return 0;
} }
/*
* write_all - Write the database to its file.
*
* It returns 0 if all the entries could be writen correctly.
*/
static int write_all (const struct commonio_db *db) static int write_all (const struct commonio_db *db)
{ {
const struct commonio_entry *p; const struct commonio_entry *p;
@ -868,7 +876,9 @@ void commonio_del_entry (struct commonio_db *db, const struct commonio_entry *p)
db->changed = 1; db->changed = 1;
} }
/*
* commonio_remove - Remove the entry of the given name from the database.
*/
int commonio_remove (struct commonio_db *db, const char *name) int commonio_remove (struct commonio_db *db, const char *name)
{ {
struct commonio_entry *p; struct commonio_entry *p;
@ -894,7 +904,15 @@ int commonio_remove (struct commonio_db *db, const char *name)
return 1; return 1;
} }
/*
* commonio_locate - Find the first entry with the specified name in
* the database.
*
* If found, it returns the entry and set the cursor of the database to
* that entry.
*
* Otherwise, it returns NULL.
*/
const void *commonio_locate (struct commonio_db *db, const char *name) const void *commonio_locate (struct commonio_db *db, const char *name)
{ {
struct commonio_entry *p; struct commonio_entry *p;
@ -912,7 +930,11 @@ const void *commonio_locate (struct commonio_db *db, const char *name)
return p->eptr; return p->eptr;
} }
/*
* commonio_rewind - Restore the database cursor to the first entry.
*
* It returns 0 on error, 1 on success.
*/
int commonio_rewind (struct commonio_db *db) int commonio_rewind (struct commonio_db *db)
{ {
if (!db->isopen) { if (!db->isopen) {
@ -923,7 +945,11 @@ int commonio_rewind (struct commonio_db *db)
return 1; return 1;
} }
/*
* commonio_next - Return the next entry of the specified database
*
* It returns the next entry, or NULL if no other entries could be found.
*/
const void *commonio_next (struct commonio_db *db) const void *commonio_next (struct commonio_db *db)
{ {
void *eptr; void *eptr;