diff options
| author | Julian Hurst <ark@mansus.space> | 2025-12-28 17:54:49 +0100 |
|---|---|---|
| committer | Julian Hurst <ark@mansus.space> | 2025-12-28 17:54:49 +0100 |
| commit | 1f1f0177f3a28837f2a25f4a240b80469442374c (patch) | |
| tree | f077a5d34cc8ed6b3b6a5a47f5f6efc4e658fd7f /imp.ha | |
| parent | 4633848d09ae158e8b410551660c71afddc91da1 (diff) | |
| download | imp-master.tar.gz | |
Diffstat (limited to 'imp.ha')
| -rw-r--r-- | imp.ha | 27 |
1 files changed, 18 insertions, 9 deletions
@@ -104,15 +104,24 @@ export fn main() void = { fmt::fatal("No file specified and the IMP_FILE environment variable isn't set"); }; - let ini_data = match (decrypt(file)) { - case let s: []u8 => - yield s; - case let e: os::exec::error => - fmt::fatal(os::exec::strerror(e)); - case let e: io::error => - fmt::fatal(io::strerror(e)); - case nomem => - fmt::fatal("Insufficient memory"); + let ini_data = if (file == "-") { + yield match (io::drain(os::stdin)) { + case let e: io::error => + fmt::fatal(io::strerror(e)); + case let u: []u8 => + yield u; + }; + } else { + yield match (decrypt(file)) { + case let s: []u8 => + yield s; + case let e: os::exec::error => + fmt::fatal(os::exec::strerror(e)); + case let e: io::error => + fmt::fatal(io::strerror(e)); + case nomem => + fmt::fatal("Insufficient memory"); + }; }; defer free(ini_data); |
