mirror of
https://github.com/uutils/coreutils
synced 2024-11-17 02:08:09 +00:00
uucore::utmpx: fix doctest errors
This commit is contained in:
parent
0277848de7
commit
434aae76bc
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.
|
||||
//
|
||||
// (c) Jian Zeng <anonymousknight96@gmail.com>
|
||||
|
@ -9,6 +5,31 @@
|
|||
// For the full copyright and license information, please view the LICENSE
|
||||
// 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;
|
||||
pub extern crate time;
|
||||
|
@ -107,28 +128,6 @@ mod ut {
|
|||
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 {
|
||||
inner: utmpx,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue