diff --git a/src/Corpus.zig b/src/Corpus.zig index 1a31d6d..b19a9fa 100644 --- a/src/Corpus.zig +++ b/src/Corpus.zig @@ -81,11 +81,14 @@ pub fn init( } }; + // TODO: replace with MultiArrayList sort when + // https://github.com/ziglang/zig/issues/11117 is done. As of writing it + // was quite a bit slower. { var name_idx = try baseAllocator.alloc(NameIdx, usersConst.len); defer baseAllocator.free(name_idx); - for (usersConst) |user, i| - name_idx[i] = NameIdx{ .name = user.name, .idx = i }; + for (usersConst) |user, i| name_idx[i] = + NameIdx{ .name = user.name, .idx = i }; sort.sort(NameIdx, name_idx, {}, Compare.name); try users.ensureTotalCapacity(allocator, usersConst.len); diff --git a/src/analyze.zig b/src/analyze.zig index d0563da..1541360 100644 --- a/src/analyze.zig +++ b/src/analyze.zig @@ -21,7 +21,7 @@ const usage = \\usage: turbo-analyze [options] [db.turbo] \\ \\ -h Print this help message and exit - \\ [db.turbo] Path to the turbonss database file (default: ./db.turbo) + \\ [db.turbo] Path to the turbonss database file (default: db.turbo) \\ ; @@ -68,7 +68,7 @@ fn execute( } const db_file = switch (myflags.args.len) { - 0 => "./db.turbo", + 0 => "db.turbo", 1 => mem.span(myflags.args[0]), else => { stderr.print("ERROR: too many arguments\n", .{}) catch {}; diff --git a/src/unix2db.zig b/src/unix2db.zig index e1b5111..0046852 100644 --- a/src/unix2db.zig +++ b/src/unix2db.zig @@ -18,8 +18,9 @@ const usage = \\usage: turbo-unix2db [options] \\ \\ -h Print this help message and exit - \\ --passwd Path to passwd file (default: ./passwd) - \\ --group Path to group file (default: ./group) + \\ --passwd Path to passwd file (default: passwd) + \\ --group Path to group file (default: group) + \\ --output Path to output file (default: db.turbo) \\ ; @@ -62,9 +63,9 @@ fn execute( return 1; } - const passwd_fname = result.argFlag("--passwd") orelse "./passwd"; - const group_fname = result.argFlag("--group") orelse "./group"; - const out_fname = result.argFlag("--output") orelse "./db.turbo"; + const passwd_fname = result.argFlag("--passwd") orelse "passwd"; + const group_fname = result.argFlag("--group") orelse "group"; + const out_fname = result.argFlag("--output") orelse "db.turbo"; // to catch an error set file.OpenError, wait for // https://github.com/ziglang/zig/issues/2473