passwd()
public
Provides a convenient Ruby iterator which executes a block for each entry
in the /etc/passwd file.
The code block is passed an Passwd struct.
See ::getpwent above for details.
Example:
require 'etc'
Etc.passwd {|u|
puts u.name + " = " + u.gecos
}
static VALUE
etc_passwd(VALUE obj)
{
#ifdef HAVE_GETPWENT
struct passwd *pw;
if (rb_block_given_p()) {
each_passwd();
}
else if ((pw = getpwent()) != 0) {
return setup_passwd(pw);
}
#endif
return Qnil;
}