home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.aix
- Path: sparky!uunet!gatech!bloom-beacon!bloom-picayune.mit.edu!athena.mit.edu!lwvanels
- From: lwvanels@athena.mit.edu (Lucien W. Van Elsen)
- Subject: Re: Using getgroupattr()
- In-Reply-To: mskucher@auk.UWaterloo.ca's message of Mon, 24 Aug 1992 18:47:50 GMT
- Message-ID: <LWVANELS.92Aug25124812@fionavar.mit.edu>
- Sender: news@athena.mit.edu (News system)
- Nntp-Posting-Host: fionavar.mit.edu
- Reply-To: lwvanels@MIT.EDU
- Organization: Massachusetts Institute of Technology
- References: <BtI47r.6xt@watserv1.uwaterloo.ca>
- Date: Tue, 25 Aug 1992 16:48:27 GMT
- Lines: 37
-
- mskucher@auk.UWaterloo.ca (Murray S. Kucherawy [MFCF]) writes:
- > The man page for getgroupattr() says that calling the routine and
- > requesting the group's users will return "a list of NULL terminated
- > character strings. The list itself is NULL terminated."
- > I'd have thought that invoking this:
-
- > char *ulist[n];
- ...
- > status = getgroupattr(groupname,S_USERS,ulist,SEC_LIST);
-
- > ...would give me an array of strings, the last of which is empty.
- > ulist[0] contains the correct first entry, but the rest of it is trash.
-
-
- The man page can be somewhat confusing- a "list of null terminated strings"
- is not the same as an array of character pointers. Instead, it means a
- single chunk of char's containing something like:
-
- user1\0user2\0user3\0\0
-
- (where user1, user2, and user3 are the usernames of the members of groupname).
-
- Calling it with
-
- char *ulist;
-
- status = getgroupattr(groupname,S_USERS,&ulist,SEC_LIST);
-
- should result in ulist being a pointer to this type of structure, which you
- can then parse yourself into the individual username strings.
-
- -Lucien
-
- ----------------------------------------------------------------------------
- Lucien Van Elsen | lwvanels@mit.edu
- | The secret to a long life is knowing when
- | it's time to go..
-