Part of #41: the comments of the thirteen small crates (`benilla-adt`, `-blp`, `-buildstamp`, `-bytes`, `-dbc`, `-m2`, `-mpq`, `-srp`, `-visual`, `-wdt`, `-wmo`, `-worldview` and `benilla`) rewritten to the rule in `docs/METHOD.md`: what the code does and the reference fact behind it, in a line. 2,176 comment lines become 1,029. - The citations that were only a private record number go first, mechanically, each edit shown to be a pure removal. - The rewrite corrects the comments that stated wrong facts: the M2 header's selection-ring claim, the texture-transform and MCNK impassable-flag notes, a DBC reader note that said short records zero-pad (they do not, #17), and about twenty more found on the way. The SRP handshake's redraw and redial are marked as a deviation, with the measured reason. - Verified: every file strips to identical code, and `cargo fmt --check` is clean. A second reader compared every file old against new and restored the facts the rewrite had dropped. String literals are untouched; they are #92. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
23 lines
907 B
Rust
23 lines
907 B
Rust
//! `mpqcat`: write one file out of an MPQ to stdout, to read the client's own data (FrameXML,
|
|
//! GlobalStrings, a BLP header).
|
|
//!
|
|
//! ```text
|
|
//! cargo run -q -p benilla-mpq --example mpqcat -- <archive.MPQ> 'Interface\FrameXML\UIParent.lua'
|
|
//! ```
|
|
//!
|
|
//! Names are the client's backslash paths. A miss is an error, not empty output: the same file
|
|
//! often lives in several archives (patch over interface over base), and "not here" must read
|
|
//! apart from "here but empty".
|
|
use std::io::Write;
|
|
|
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
let mut args = std::env::args().skip(1);
|
|
let (Some(archive), Some(name)) = (args.next(), args.next()) else {
|
|
eprintln!("usage: mpqcat <archive.MPQ> <file-in-archive>");
|
|
std::process::exit(2);
|
|
};
|
|
let bytes = benilla_mpq::Archive::open(&archive)?.read_file(&name)?;
|
|
std::io::stdout().write_all(&bytes)?;
|
|
Ok(())
|
|
}
|