Esempio n. 1
0
func uptime(fname string, opts int) {
	entries := uint64(0)
	us, err := utmp.ReadUtmp(fname, &entries, 0, opts)
	if err != nil {
		fatal.Fatalln(err)
	}

	printUptime(us)
}
Esempio n. 2
0
func who(fname string, opts int) {
	var users uint64
	ub := make(utmp.UtmpBuffer)

	if err := utmp.ReadUtmp(fname, users, &ub, opts); err != nil {
		log.Fatalf("%s %s\n", fname, err)
	}

	if *count {
		listEntriesWho(users, &ub)
	} else {
		scanEntries(users, &ub)
	}
}