group()
public
Provides a convenient Ruby iterator which executes a block for each entry
in the /etc/group file.
The code block is passed an Group struct.
See ::getgrent above for details.
Example:
require 'etc'
Etc.group {|g|
puts g.name + ": " + g.mem.join(', ')
}
static VALUE
etc_group(VALUE obj)
{
#ifdef HAVE_GETGRENT
struct group *grp;
if (rb_block_given_p()) {
each_group();
}
else if ((grp = getgrent()) != 0) {
return setup_group(grp);
}
#endif
return Qnil;
}