#login #utmp #linux

utmp-raw

Provides raw types for parsing login records in utmp file

5 unstable releases

0.3.0 Jul 24, 2022
0.2.0 Nov 21, 2021
0.1.2 Feb 9, 2020
0.1.1 Feb 9, 2020
0.1.0 Feb 2, 2020

#674 in Unix APIs

Download history 90/week @ 2023-11-20 104/week @ 2023-11-27 63/week @ 2023-12-04 88/week @ 2023-12-11 127/week @ 2023-12-18 42/week @ 2023-12-25 100/week @ 2024-01-01 144/week @ 2024-01-08 242/week @ 2024-01-15 146/week @ 2024-01-22 308/week @ 2024-01-29 347/week @ 2024-02-05 199/week @ 2024-02-12 359/week @ 2024-02-19 236/week @ 2024-02-26 97/week @ 2024-03-04

906 downloads per month
Used in 4 crates (2 directly)

MIT license

9KB
179 lines

utmp-rs

Crates.io Docs

A Rust crate for parsing utmp files like /var/run/utmp and /var/log/wtmp.

Usage

Simplest way is to use parse_from_* functions, which returns a Vec<UtmpEntry> on success:

let entries = utmp_rs::parse_from_path("/var/run/utmp")?;
// ...

If you don't need to collect them all, UtmpParser can be used as an iterator:

use utmp_rs::UtmpParser;
for entry in UtmpParser::from_path("/var/run/utmp")? {
    let entry = entry?;
    // ...
}

All the parse_from_* functions as well as UtmpParser parse utmp file based on the native format for the target platform. If cross-platform parsing is needed, Utmp32Parser or Utmp64Parser can be used instead of UtmpParser.

Dependencies

~1–1.6MB
~29K SLoC