diff options
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); |
