update cat example code

This commit is contained in:
Andrew Kelley 2017-01-24 02:06:56 -05:00
parent 4b3f18de3c
commit 34a4d7a201

View File

@ -8,7 +8,7 @@ pub fn main(args: [][]u8) -> %void {
for (args[1...]) |arg| {
if (str.eql(arg, "-")) {
catted_anything = true;
cat_stream(&io.stdin) %% |err| return err;
%return cat_stream(&io.stdin);
} else if (arg[0] == '-') {
return usage(exe);
} else {
@ -20,13 +20,13 @@ pub fn main(args: [][]u8) -> %void {
defer %%is.close();
catted_anything = true;
cat_stream(&is) %% |err| return err;
%return cat_stream(&is);
}
}
if (!catted_anything) {
cat_stream(&io.stdin) %% |err| return err;
%return cat_stream(&io.stdin);
}
io.stdout.flush() %% |err| return err;
%return io.stdout.flush();
}
fn usage(exe: []u8) -> %void {