mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
update cat example code
This commit is contained in:
parent
4b3f18de3c
commit
34a4d7a201
@ -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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user