Method: Etc.getpwent

Defined in:
etc.c

.getpwentObject

getpwent -> Etc::Passwd

Returns an entry from the /etc/passwd file.

The first time it is called it opens the file and returns the first entry; each successive call returns the next entry, or nil if the end of the file has been reached.

To close the file when processing is complete, call ::endpwent.

Each entry is returned as a Passwd struct.



426
427
428
429
430
431
432
433
434
435
436
437
# File 'etc.c', line 426

static VALUE
etc_getpwent(VALUE obj)
{
#ifdef HAVE_GETPWENT
    struct passwd *pw;

    if ((pw = getpwent()) != 0) {
	return setup_passwd(pw);
    }
#endif
    return Qnil;
}