/*
 * Shows number of users. Returns output 2x -> made for MRTG.
 *
 * This program is in the public domain.
 */

#include <sys/types.h>

#include <stdio.h>
#include <paths.h>
#include <utmp.h>

int 
main(void)
{
	struct utmp ut;
	int count = 0;
	FILE *fp;

	if ((fp = fopen(_PATH_UTMP, "r")) == NULL)
		return (0);

	while (fread(&ut, sizeof(ut), 1, fp) == 1) {
		if (*ut.ut_name == '\0')
			continue;
		count++;
	}

	printf("%d\n%d\n", count, count);

	return (0);
}
