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