/* Returns the /etc/passwd information for the user with specified login name.
*
* The information is returned as a Struct::Passwd; see getpwent above for
* details.
*
* e.g. * Etc.getpwnam('root') -> #<struct Struct::Passwd name="root",
* passwd="x", uid=0, gid=0, gecos="root",dir="/root", shell="/bin/bash">
*/
static VALUE
etc_getpwnam(VALUE obj, VALUE nam)
{
#ifdef HAVE_GETPWENT
struct passwd *pwd;
SafeStringValue(nam);
pwd = getpwnam(RSTRING_PTR(nam));
if (pwd == 0) rb_raise(rb_eArgError, "can't find user for %s", RSTRING_PTR(nam));
return setup_passwd(pwd);
#else
return Qnil;
#endif
}