/* getugroups.c -- return a list of the groups a user is in
- Copyright (C) 1990, 1991, 1998, 1999, 2000, 2003, 2004, 2005 Free
- Software Foundation.
+ Copyright (C) 1990, 1991, 1998-2000, 2003-2007 Free Software Foundation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
/* Written by David MacKenzie. */
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
+
+#include "getugroups.h"
-#include <sys/types.h>
#include <stdio.h> /* grp.h on alpha OSF1 V2.0 uses "FILE *". */
#include <grp.h>
Always return the number of groups of which USERNAME is a member. */
int
-getugroups (int maxcount, GETGROUPS_T *grouplist, char *username, gid_t gid)
+getugroups (int maxcount, GETGROUPS_T *grouplist, char const *username,
+ gid_t gid)
{
struct group *grp;
- register char **cp;
- register int count = 0;
+ int count = 0;
if (gid != (gid_t) -1)
{
setgrent ();
while ((grp = getgrent ()) != 0)
{
+ char **cp;
for (cp = grp->gr_mem; *cp; ++cp)
{
int n;