diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2025-08-18 21:05:55 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2025-08-18 21:05:55 +0200 |
commit | 6863efdb6ff2a739752a49afce671f0303fe5df1 (patch) | |
tree | 9021964eb90a9d61654db9416cfee895d7994806 | |
parent | d06385337b1f2d53da7689c17deaa2a910178c51 (diff) |
DIR: Make the output uppercase again.
It should only be lowercase if the /L flag is passed, but that isn't
implemented.
-rw-r--r-- | src/cmd/dir.zig | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/cmd/dir.zig b/src/cmd/dir.zig index ffb38e2..94ca29b 100644 --- a/src/cmd/dir.zig +++ b/src/cmd/dir.zig @@ -161,14 +161,9 @@ pub const Dir = struct { defer ctx.allocator.free(short_name.name); defer ctx.allocator.free(short_name.ext); - // Create lowercase versions of name and extension - const lower_name_buf = try ctx.allocator.alloc(u8, short_name.name.len); - defer ctx.allocator.free(lower_name_buf); - const lower_name = std.ascii.lowerString(lower_name_buf, short_name.name); - - const lower_ext_buf = try ctx.allocator.alloc(u8, short_name.ext.len); - defer ctx.allocator.free(lower_ext_buf); - const lower_ext = std.ascii.lowerString(lower_ext_buf, short_name.ext); + // Format the output. + const name = short_name.name; + const ext = short_name.ext; switch (entry.kind) { .directory => { @@ -177,7 +172,7 @@ pub const Dir = struct { } else if (dir.wide_format) { try output_buffer.writer().print("{s:<12} ", .{entry.name}); } else { - try output_buffer.writer().print("{s:<8} {s:<3} <DIR> {s}\n", .{ lower_name, lower_ext, date_time }); + try output_buffer.writer().print("{s:<8} {s:<3} <DIR> {s}\n", .{ name, ext, date_time }); } dir_count += 1; }, @@ -189,7 +184,7 @@ pub const Dir = struct { } else { const formatted_size = try formatWithCommas(ctx.allocator, stat.size); defer ctx.allocator.free(formatted_size); - try output_buffer.writer().print("{s:<8} {s:<3} {s:>14} {s}\n", .{ lower_name, lower_ext, formatted_size, date_time }); + try output_buffer.writer().print("{s:<8} {s:<3} {s:>14} {s}\n", .{ name, ext, formatted_size, date_time }); } file_count += 1; total_file_bytes += stat.size; |