36 #include <sys/types.h>
39 #include <sys/param.h>
44 int ttystat(
char *line,
int sz);
65 static struct stat sb;
66 char ttybuf[MAXPATHLEN];
69 (void)snprintf(ttybuf,
sizeof(ttybuf),
"%s%.*s", _PATH_DEV, sz, line);
72 if(stat(ttybuf, &sb) == 0) {
98 if((ut = fopen(_PATH_UTMP,
"r")) == NULL) {
99 printf(
"Error calculating users logged in, could not read file %s\n",
105 for(;fread(&utmp,
sizeof(utmp), 1, ut);) {
107 if(utmp.ut_name[0] ==
'\0') {
112 if(!
ttystat(utmp.ut_line, UT_LINESIZE)) {
146 if(!getloadavg(loadavg, 3)) {
147 printf(
"Error, could not retreive system load averages.\n");
152 if(loadavg[1] < 0.10) {