home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / aix / 9053 < prev    next >
Encoding:
Text File  |  1992-08-25  |  1.8 KB  |  52 lines

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