STRUCT_UTMP *u;
STRUCT_UTMP *utmp = NULL;
- if (utmpname (filename))
- return 1;
+ /* Ignore the return value for now.
+ Solaris' utmpname returns 1 upon success -- which is contrary
+ to what the GNU libc version does. In addition, older GNU libc
+ versions are actually void. */
+ UTMP_NAME_FUNCTION (filename);
- setutent ();
+ SET_UTMP_ENT ();
n_read = 0;
- while ((u = getutent ()) != NULL)
+ while ((u = GET_UTMP_ENT ()) != NULL)
{
++n_read;
utmp = (STRUCT_UTMP *) realloc (utmp, n_read * sizeof (STRUCT_UTMP));
utmp[n_read - 1] = *u;
}
- endutent ();
+ END_UTMP_ENT ();
*n_entries = n_read;
*utmp_buf = utmp;