procutils-common 0.1.0

Shared utilities for procutils tools (utmp, signal, procmatch, fmt, uid)
Documentation
//! Shared utilities used by the `procutils` workspace.
//!
//! This crate is a support library, not an end-user tool — it exists
//! to keep parsing, matching, and formatting logic in one place across
//! the procutils binaries. Each module is small and self-contained:
//!
//! - [`fmt`]: human-readable size formatters (`K`/`M`/`G`/`T`).
//! - [`man`]: per-tool man-page content shared with the man-page generator.
//! - [`procmatch`]: process selection logic shared by `pgrep`, `pkill`,
//!   `skill`, `snice` — regex matching plus filters on PID, UID,
//!   parent, session, tty, run-state, environment, and more.
//! - [`signal`]: canonical signal-number/name table and `parse_signal`
//!   used by `kill`, `pkill`, `skill`.
//! - [`uid`]: UID-to-username lookups backed by `/etc/passwd`, with a
//!   small per-process cache.
//! - [`utmp`]: reader for the `utmp(5)` binary file format used by
//!   `/var/run/utmp`. The on-disk stride is computed from `libc::utmpx`
//!   so the parser stays correct across glibc architectures.
//!
//! The API is **not stable** and may change without notice between
//! releases. This crate is intended for internal use by the procutils
//! workspace only.

pub mod fmt;
pub mod man;
pub mod procmatch;
pub mod signal;
pub mod uid;
pub mod utmp;

/// Default maximum width for help-text wrapping in clap-derived CLIs.
///
/// 100 columns matches what most tools in the workspace use; setting it
/// here keeps clap output consistent across all 18 binaries.
pub const MAX_TERM_WIDTH: usize = 100;