| ... | @@ -1,12 +1,12 @@ | ... | @@ -1,12 +1,12 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const io = std.io; | 2 | const io = std.io; |
| 3 | const str = std.str; | 3 | const mem = std.mem; |
| 4 | | 4 | |
| 5 | pub fn main(args: [][]u8) -> %void { | 5 | pub fn main(args: [][]u8) -> %void { |
| 6 | const exe = args[0]; | 6 | const exe = args[0]; |
| 7 | var catted_anything = false; | 7 | var catted_anything = false; |
| 8 | for (args[1...]) |arg| { | 8 | for (args[1...]) |arg| { |
| 9 | if (str.eql(arg, "-")) { | 9 | if (mem.eql(u8, arg, "-")) { |
| 10 | catted_anything = true; | 10 | catted_anything = true; |
| 11 | %return cat_stream(&io.stdin); | 11 | %return cat_stream(&io.stdin); |
| 12 | } else if (arg[0] == '-') { | 12 | } else if (arg[0] == '-') { |
| ... | @@ -38,7 +38,7 @@ fn cat_stream(is: &io.InStream) -> %void { | ... | @@ -38,7 +38,7 @@ fn cat_stream(is: &io.InStream) -> %void { |
| 38 | var buf: [1024 * 4]u8 = undefined; | 38 | var buf: [1024 * 4]u8 = undefined; |
| 39 | | 39 | |
| 40 | while (true) { | 40 | while (true) { |
| 41 | const bytes_read = is.read(buf) %% |err| { | 41 | const bytes_read = is.read(buf[0...]) %% |err| { |
| 42 | %%io.stderr.printf("Unable to read from stream: {}\n", @errorName(err)); | 42 | %%io.stderr.printf("Unable to read from stream: {}\n", @errorName(err)); |
| 43 | return err; | 43 | return err; |
| 44 | }; | 44 | }; |