| 1 | const std = @import("std"); |
| 2 | |
| 3 | pub fn main(init: std.process.Init) !void { |
| 4 | const arena = init.arena.allocator(); |
| 5 | const io = init.io; |
| 6 | const args = try init.minimal.args.toSlice(arena); |
| 7 | |
| 8 | if (args.len != 3) return error.BadUsage; // usage: 'check_differ <path a> <path b>' |
| 9 | |
| 10 | const contents_1 = try std.Io.Dir.cwd().readFileAlloc(io, args[1], arena, .limited(1024 * 1024 * 64)); // 64 MiB ought to be plenty |
| 11 | const contents_2 = try std.Io.Dir.cwd().readFileAlloc(io, args[2], arena, .limited(1024 * 1024 * 64)); // 64 MiB ought to be plenty |
| 12 | |
| 13 | if (std.mem.eql(u8, contents_1, contents_2)) { |
| 14 | return error.FilesMatch; |
| 15 | } |
| 16 | // success, files differ |
| 17 | } |