bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

getugroups.h: new file


From: Jim Meyering
Subject: getugroups.h: new file
Date: Wed, 04 Jul 2007 23:46:56 +0200

FYI, I've finally moved the declaration of getugroups into
its own header file.  Cleaned up some nits along the way:

        * lib/getugroups.h: New file.
        * lib/getugroups.c: Include "getugroups.h".
        Remove uses of "register" keyword.
        Move local variable, "cp", down into scope where used.
        Give "username" parameter the "const" attribute.
        * modules/getugroups (Files): Add lib/getugroups.h

Index: lib/getugroups.h
===================================================================
RCS file: lib/getugroups.h
diff -N lib/getugroups.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ lib/getugroups.h    4 Jul 2007 21:45:13 -0000
@@ -0,0 +1,21 @@
+/* Get a list of group IDs associated with a specified user ID.
+   Copyright (C) 2007 Free Software Foundation, Inc.
+
+   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
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; see the file COPYING.
+   If not, write to the Free Software Foundation,
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#include <sys/types.h>
+int getugroups (int maxcount, GETGROUPS_T *grouplist, char const *username,
+               gid_t gid);
Index: lib/getugroups.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/getugroups.c,v
retrieving revision 1.17
diff -u -p -r1.17 getugroups.c
--- lib/getugroups.c    13 Sep 2006 22:38:14 -0000      1.17
+++ lib/getugroups.c    4 Jul 2007 21:45:13 -0000
@@ -1,7 +1,6 @@
 /* getugroups.c -- return a list of the groups a user is in

-   Copyright (C) 1990, 1991, 1998, 1999, 2000, 2003, 2004, 2005, 2006
-   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
@@ -21,7 +20,8 @@

 #include <config.h>

-#include <sys/types.h>
+#include "getugroups.h"
+
 #include <stdio.h> /* grp.h on alpha OSF1 V2.0 uses "FILE *". */
 #include <grp.h>

@@ -49,11 +49,11 @@ struct group *getgrent ();
    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)
     {
@@ -65,6 +65,7 @@ getugroups (int maxcount, GETGROUPS_T *g
   setgrent ();
   while ((grp = getgrent ()) != 0)
     {
+      char **cp;
       for (cp = grp->gr_mem; *cp; ++cp)
        {
          int n;
Index: modules/getugroups
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/getugroups,v
retrieving revision 1.7
diff -u -p -r1.7 getugroups
--- modules/getugroups  13 Oct 2006 12:40:23 -0000      1.7
+++ modules/getugroups  4 Jul 2007 21:45:13 -0000
@@ -3,6 +3,7 @@ Return the group IDs of a user.

 Files:
 lib/getugroups.c
+lib/getugroups.h
 m4/getugroups.m4

 Depends-on:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]