#include #include #include #include int main() { int status = EXIT_FAILURE; /* guilty until proven innocent */ const struct utmpx *p; setutxent(); while ((p = getutxent()) != NULL) { if (strcmp(p->ut_user, "mm64") == 0) { char buffer[100]; cftime(buffer, NULL, &p->ut_tv.tv_sec); printf("%d ", p->ut_type); /* what type of process */ printf("%s ", p->ut_host); /* where logged in from */ printf("%s ", p->ut_line); /* which terminal */ printf("%s\n", buffer); /* what time */ status = EXIT_SUCCESS; break; } } endutxent(); return status; }