/* Returns information about the group with specified String name, as found
* in /etc/group.
*
* The information is returned as a Struct::Group; see getgrent above for
* details.
*
* e.g. Etc.getgrnam('users') -> #<struct Struct::Group name="users",
* passwd="x", gid=100, mem=["meta", "root"]>
*
*/
static VALUE
etc_getgrnam(VALUE obj, VALUE nam)
{
#ifdef HAVE_GETGRENT
struct group *grp;
rb_secure(4);
SafeStringValue(nam);
grp = getgrnam(RSTRING_PTR(nam));
if (grp == 0) rb_raise(rb_eArgError, "can't find group for %s", RSTRING_PTR(nam));
return setup_group(grp);
#else
return Qnil;
#endif
}