home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / posix / grp / getgrent.txh < prev    next >
Encoding:
Text File  |  1995-07-10  |  3.1 KB  |  143 lines

  1. @c ----------------------------------------------------------------------
  2. @node getgrent, unix
  3. @subheading Syntax
  4.  
  5. @example
  6. #include <grp.h>
  7.  
  8. struct group *getgrent(void);
  9. @end example
  10.  
  11. @subheading Description
  12.  
  13. This function returns the next available group entry.  Note that for
  14. MS-DOS, this is simulated.  If the environment variable GROUP is set,
  15. that is the name of the only group returned, else the only group is
  16. "dos".  Thus, under DOS, @code{getgrent} will always fail on the
  17. second and subsequent calls.
  18.  
  19. The return type of this and related function is as follows:
  20.  
  21. @example
  22. struct group @{
  23.   gid_t    gr_gid;    /* result of getgid() */
  24.   char  ** gr_mem;    /* gr_mem[0] points to
  25.                           getenv("USER"/"LOGNAME") or "user" */
  26.   char  *  gr_name;   /* getenv("GROUP") or "dos" */
  27. @};
  28. @end example
  29.  
  30. @subheading Return Value
  31.  
  32. The next structure, or @code{NULL} at the end of the list.
  33.  
  34. @subheading Example
  35.  
  36. @example
  37.  
  38. struct group *g;
  39. setgrent();
  40. while ((g = getgrent()) != NULL)
  41. @{
  42.   printf("group %s gid %d\n", g->gr_name, g->gr_gid);
  43. @}
  44. endgrent();
  45. @end example
  46.  
  47. @c ----------------------------------------------------------------------
  48. @node fgetgrent, unix
  49. @subheading Syntax
  50.  
  51. @example
  52. #include <grp.h>
  53.  
  54. struct group *fgetgrent(FILE *file);
  55. @end example
  56.  
  57. @subheading Description
  58.  
  59. This function, in MS-DOS, is exactly the same as @code{getgrent}
  60. (@pxref{getgrent}). 
  61.  
  62. @c ----------------------------------------------------------------------
  63. @node setgrent, unix
  64. @subheading Syntax
  65.  
  66. @example
  67. #include <grp.h>
  68.  
  69. void setgrent(void);
  70. @end example
  71.  
  72. @subheading Description
  73.  
  74. This function should be called before any call to @code{getgrent},
  75. @code{getgrgid}, or @code{getgrnam}, to start searching the groups' list
  76. from the beginning.  @xref{getgrent}.
  77.  
  78. @subheading Return Value
  79.  
  80. None.
  81.  
  82. @c ----------------------------------------------------------------------
  83. @node endgrent, unix
  84. @subheading Syntax
  85.  
  86. @example
  87. #include <grp.h>
  88.  
  89. void endgrent(void);
  90. @end example
  91.  
  92. @subheading Description
  93.  
  94. This function should be called after all calls to @code{getgrent},
  95. @code{getgrgid}, or @code{getgrnam}. 
  96.  
  97. @subheading Return Value
  98.  
  99. None.
  100.  
  101. @subheading Example
  102.  
  103. @xref{getgrent}.
  104.  
  105. @c ----------------------------------------------------------------------
  106. @node getgrgid, unix
  107. @subheading Syntax
  108.  
  109. @example
  110. #include <grp.h>
  111.  
  112. extern struct group *getgrgid(int gid);
  113. @end example
  114.  
  115. @subheading Description
  116.  
  117. This function returns the group entry that matches @var{gid}. 
  118. @xref{getgrent}, for the description of @code{struct group}.
  119.  
  120. @subheading Return Value
  121.  
  122. The matching group, or @code{NULL} if none match.
  123.  
  124. @c ----------------------------------------------------------------------
  125. @node getgrnam, unix
  126. @subheading Syntax
  127.  
  128. @example
  129. #include <grp.h>
  130.  
  131. struct group *getgrnam(char *name);
  132. @end example
  133.  
  134. @subheading Description
  135.  
  136. This function returns the group entry for the group named @var{name}. 
  137. @xref{getgrent} for the description of @code{struct group}.
  138.  
  139. @subheading Return Value
  140.  
  141. The matching group, or @code{NULL} if none match.
  142.  
  143.