File: hasutmploginlogout.c

package info (click to toggle)
tinyssh 20250501-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,388 kB
  • sloc: ansic: 20,245; sh: 1,582; python: 1,449; makefile: 913
file content (18 lines) | stat: -rw-r--r-- 319 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* Public domain. */
#include <time.h>
#include <sys/time.h>
#include <utmp.h>

extern void login(const struct utmp *);
extern int logout(const char *);

static void foo(void) {
    struct utmp ut = {0};
    login(&ut);
    logout(ut.ut_line);
}

int main(int argc, char **argv) {
    if (!argc) foo();
    return 0;
}