home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / man / cat3 / getgrent.0 < prev    next >
Text File  |  1993-12-07  |  5KB  |  133 lines

  1.  
  2. GETGRENT(3)                UNIX Programmer's Manual                GETGRENT(3)
  3.  
  4. NNAAMMEE
  5.      ggeettggrreenntt, ggeettggrrnnaamm, ggeettggrrggiidd, sseettggrroouuppeenntt, sseettggrreenntt, eennddggrreenntt - group
  6.      database operations
  7.  
  8. SSYYNNOOPPSSIISS
  9.      ##iinncclluuddee <<ggrrpp..hh>>
  10.  
  11.      _s_t_r_u_c_t _g_r_o_u_p _*
  12.      ggeettggrreenntt(_v_o_i_d)
  13.  
  14.      _s_t_r_u_c_t _g_r_o_u_p _*
  15.      ggeettggrrnnaammee(_c_o_n_s_t _c_h_a_r _*_n_a_m_e)
  16.  
  17.      _s_t_r_u_c_t _g_r_o_u_p _*
  18.      ggeettggrrggiidd(_g_i_d___t _g_i_d)
  19.  
  20.      _s_t_r_u_c_t _g_r_o_u_p _*
  21.      sseettggrroouuppeenntt(_i_n_t _s_t_a_y_o_p_e_n)
  22.  
  23.      _i_n_t
  24.      sseettggrreenntt(_v_o_i_d)
  25.  
  26.      _v_o_i_d
  27.      eennddggrreenntt(_v_o_i_d)
  28.  
  29. DDEESSCCRRIIPPTTIIOONN
  30.      These functions operate on the group database file _/_e_t_c_/_g_r_o_u_p which is
  31.      described in group(5).  Each line of the database is defined by the
  32.      structure _g_r_o_u_p found in the include file <_g_r_p_._h>:
  33.  
  34.            struct group {
  35.                    char    *gr_name;       /* group name */
  36.                    char    *gr_passwd;     /* group password */
  37.                    gid_t   gr_gid;         /* group id */
  38.                    char    **gr_mem;       /* group members */
  39.            };
  40.  
  41.      The functions ggeettggrrnnaamm() and ggeettggrrggiidd() search the group database for the
  42.      given group name pointed to by _n_a_m_e or the group id pointed to by _g_i_d,
  43.      respectively, returning the first one encountered.  Identical group names
  44.      or group gids may result in undefined behavior.
  45.  
  46.      The ggeettggrreenntt() function sequentially reads the group database and is in­
  47.      tended for programs that wish to step through the complete list of
  48.      groups.
  49.  
  50.      All three routines will open the group file for reading, if necesssary.
  51.  
  52.      The sseettggrroouuppeenntt() function opens the file, or rewinds it if it is already
  53.      open.  If _s_t_a_y_o_p_e_n is non­zero, file descriptors are left open, signifi­
  54.      cantly speeding functions subsequent calls.  This functionality is unnec­
  55.      essary for ggeettggrreenntt() as it doesn't close its file descriptors by de­
  56.      fault.  It should also be noted that it is dangerous for long­running
  57.      programs to use this functionality as the group file may be updated.
  58.  
  59.      The sseettggrreenntt() function is identical to sseettggrroouuppeenntt() with an argument of
  60.      zero.
  61.  
  62.      The eennddggrreenntt() function closes any open files.
  63.  
  64. RREETTUURRNN VVAALLUUEESS
  65.      The functions ggeettggrreenntt(), ggeettggrrnnaamm(), and ggeettggrrggiidd(), return a pointer to
  66.      the group entry if successful; if end­of­file is reached or an error oc­
  67.      curs a null pointer is returned.  The functions sseettggrroouuppeenntt() and
  68.      sseettggrreenntt() return the value 1 if successful, otherwise the value 0 is re­
  69.      turned.  The functions eennddggrreenntt() and sseettggrrffiillee() have no return value.
  70.  
  71. FFIILLEESS
  72.      /etc/group  group database file
  73.  
  74. SSEEEE AALLSSOO
  75.      ggeettppwweenntt(_3), ggrroouupp(_5)
  76.  
  77. HHIISSTTOORRYY
  78.      The functions eennddggrreenntt(), ggeettggrreenntt(), ggeettggrrnnaamm(), ggeettggrrggiidd(), and
  79.      sseettggrreenntt() appeared in Version 7 AT&T UNIX.  The functions sseettggrrffiillee()
  80.      and sseettggrroouuppeenntt() appeared in 4.3BSD-Reno.
  81.  
  82. CCOOMMPPAATTIIBBIILLIITTYY
  83.      The historic function sseettggrrffiillee(), which allowed the specification of al­
  84.      ternate password databases, has been deprecated and is no longer avail­
  85.      able.
  86.  
  87. BBUUGGSS
  88.      The functions ggeettggrreenntt(), ggeettggrrnnaamm(), ggeettggrrggiidd(), sseettggrroouuppeenntt() and
  89.      sseettggrreenntt() leave their results in an internal static object and return a
  90.      pointer to that object. Subsequent calls to the same function will modify
  91.      the same object.
  92.  
  93.      The functions ggeettggrreenntt(), eennddggrreenntt(), sseettggrroouuppeenntt(), and sseettggrreenntt() are
  94.      fairly useless in a networked environment and should be avoided, if pos­
  95.      sible.
  96.  
  97. BSD Experimental                April 20, 1991                               2
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.