[svn-upgrade] Integrating new upstream version, shadow (4.0.0)
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "rcsid.h"
|
||||
RCSID("$Id: groupio.c,v 1.9 2000/09/02 18:40:43 marekm Exp $")
|
||||
RCSID("$Id: groupio.c,v 1.10 2001/08/14 21:10:36 malekith Exp $")
|
||||
|
||||
#include "prototypes.h"
|
||||
#include "defines.h"
|
||||
@ -177,8 +177,42 @@ __gr_get_head(void)
|
||||
return group_db.head;
|
||||
}
|
||||
|
||||
struct commonio_db *
|
||||
__gr_get_db(void)
|
||||
{
|
||||
return &group_db;
|
||||
}
|
||||
|
||||
void
|
||||
__gr_del_entry(const struct commonio_entry *ent)
|
||||
{
|
||||
commonio_del_entry(&group_db, ent);
|
||||
}
|
||||
|
||||
static int
|
||||
gr_cmp(const void *p1, const void *p2)
|
||||
{
|
||||
gid_t u1, u2;
|
||||
|
||||
if ((*(struct commonio_entry**)p1)->eptr == NULL)
|
||||
return 1;
|
||||
if ((*(struct commonio_entry**)p2)->eptr == NULL)
|
||||
return -1;
|
||||
|
||||
u1 = ((struct group *)(*(struct commonio_entry**)p1)->eptr)->gr_gid;
|
||||
u2 = ((struct group *)(*(struct commonio_entry**)p2)->eptr)->gr_gid;
|
||||
|
||||
if (u1 < u2)
|
||||
return -1;
|
||||
else if (u1 > u2)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Sort entries by gid */
|
||||
int
|
||||
gr_sort()
|
||||
{
|
||||
return commonio_sort(&group_db, gr_cmp);
|
||||
}
|
||||
|
Reference in New Issue
Block a user