summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--imp.ha27
1 files changed, 18 insertions, 9 deletions
diff --git a/imp.ha b/imp.ha
index 73cdad5..c7fdfb9 100644
--- a/imp.ha
+++ b/imp.ha
@@ -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);