|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 337 (0x151)
Types: TextFile
Names: »user_count.c«
└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
└─⟦this⟧ »EUUGD11/euug-87hel/sec8/mon/user_count.c«
#include <stdio.h>
#include <utmp.h>
int user_count()
{
static int first = 1;
static FILE *strm;
struct utmp utmp;
int count = 0;
if (first)
{
strm = fopen("/etc/utmp", "r");
first = 0;
}
rewind(strm);
while(fread(&utmp, sizeof(utmp), 1, strm))
{
if (utmp.ut_name[0] != '\0')
count++;
}
return(count);
}