mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 20:47:46 +00:00
uucore::utmpx: fix doctest errors
This commit is contained in:
parent
2dd816739f
commit
c2fb66dfcb
1 changed files with 25 additions and 26 deletions
|
@ -1,7 +1,3 @@
|
||||||
//! Aim to provide platform-independent methods to obtain login records
|
|
||||||
//!
|
|
||||||
//! **ONLY** support linux, macos and freebsd for the time being
|
|
||||||
|
|
||||||
// This file is part of the uutils coreutils package.
|
// This file is part of the uutils coreutils package.
|
||||||
//
|
//
|
||||||
// (c) Jian Zeng <anonymousknight96@gmail.com>
|
// (c) Jian Zeng <anonymousknight96@gmail.com>
|
||||||
|
@ -9,6 +5,31 @@
|
||||||
// For the full copyright and license information, please view the LICENSE
|
// For the full copyright and license information, please view the LICENSE
|
||||||
// file that was distributed with this source code.
|
// file that was distributed with this source code.
|
||||||
//
|
//
|
||||||
|
//! Aims to provide platform-independent methods to obtain login records
|
||||||
|
//!
|
||||||
|
//! **ONLY** support linux, macos and freebsd for the time being
|
||||||
|
//!
|
||||||
|
//! # Examples:
|
||||||
|
//!
|
||||||
|
//! ```
|
||||||
|
//! use uucore::utmpx::Utmpx;
|
||||||
|
//! for ut in Utmpx::iter_all_records() {
|
||||||
|
//! if ut.is_user_process() {
|
||||||
|
//! println!("{}: {}", ut.host(), ut.user())
|
||||||
|
//! }
|
||||||
|
//! }
|
||||||
|
//! ```
|
||||||
|
//!
|
||||||
|
//! Specifying the path to login record:
|
||||||
|
//!
|
||||||
|
//! ```
|
||||||
|
//! use uucore::utmpx::Utmpx;
|
||||||
|
//! for ut in Utmpx::iter_all_records().read_from("/some/where/else") {
|
||||||
|
//! if ut.is_user_process() {
|
||||||
|
//! println!("{}: {}", ut.host(), ut.user())
|
||||||
|
//! }
|
||||||
|
//! }
|
||||||
|
//! ```
|
||||||
|
|
||||||
use super::libc;
|
use super::libc;
|
||||||
pub extern crate time;
|
pub extern crate time;
|
||||||
|
@ -107,28 +128,6 @@ mod ut {
|
||||||
pub use libc::SHUTDOWN_TIME;
|
pub use libc::SHUTDOWN_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Login records
|
|
||||||
///
|
|
||||||
/// Examples:
|
|
||||||
/// ---------
|
|
||||||
///
|
|
||||||
/// ```
|
|
||||||
/// for ut in Utmpx::iter_all_records() {
|
|
||||||
/// if ut.is_user_process() {
|
|
||||||
/// println!("{}: {}", ut.host(), ut.user())
|
|
||||||
/// }
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
///
|
|
||||||
/// Specifying the path to login record:
|
|
||||||
///
|
|
||||||
/// ```
|
|
||||||
/// for ut in Utmpx::iter_all_records().read_from("/some/where/else") {
|
|
||||||
/// if ut.is_user_process() {
|
|
||||||
/// println!("{}: {}", ut.host(), ut.user())
|
|
||||||
/// }
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
pub struct Utmpx {
|
pub struct Utmpx {
|
||||||
inner: utmpx,
|
inner: utmpx,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue