show endianess better
This commit is contained in:
parent
f2570529d7
commit
4e9f609131
@ -30,7 +30,7 @@ const Info = struct {
|
|||||||
size_file: []const u8,
|
size_file: []const u8,
|
||||||
bytes_file: os.off_t,
|
bytes_file: os.off_t,
|
||||||
version: meta.fieldInfo(Header, .version).field_type,
|
version: meta.fieldInfo(Header, .version).field_type,
|
||||||
endian: meta.fieldInfo(Header, .endian).field_type,
|
endian: []const u8,
|
||||||
ptr_size: meta.fieldInfo(Header, .ptr_size).field_type,
|
ptr_size: meta.fieldInfo(Header, .ptr_size).field_type,
|
||||||
getgr_bufsize: meta.fieldInfo(Header, .getgr_bufsize).field_type,
|
getgr_bufsize: meta.fieldInfo(Header, .getgr_bufsize).field_type,
|
||||||
getpw_bufsize: meta.fieldInfo(Header, .getpw_bufsize).field_type,
|
getpw_bufsize: meta.fieldInfo(Header, .getpw_bufsize).field_type,
|
||||||
@ -106,8 +106,8 @@ fn execute(
|
|||||||
defer file.close();
|
defer file.close();
|
||||||
const db = file.db;
|
const db = file.db;
|
||||||
|
|
||||||
var scratch: [16]u8 = undefined;
|
var file_size_scratch: [16]u8 = undefined;
|
||||||
const buf = fmt.bufPrint(scratch[0..], "{:.2}", .{
|
const buf = fmt.bufPrint(file_size_scratch[0..], "{:.2}", .{
|
||||||
fmt.fmtIntSizeBin(@intCast(u64, file_size_bytes)),
|
fmt.fmtIntSizeBin(@intCast(u64, file_size_bytes)),
|
||||||
}) catch unreachable;
|
}) catch unreachable;
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ fn execute(
|
|||||||
.size_file = buf,
|
.size_file = buf,
|
||||||
.bytes_file = file_size_bytes,
|
.bytes_file = file_size_bytes,
|
||||||
.version = db.header.version,
|
.version = db.header.version,
|
||||||
.endian = db.header.endian,
|
.endian = @tagName(db.header.endian),
|
||||||
.ptr_size = db.header.ptr_size,
|
.ptr_size = db.header.ptr_size,
|
||||||
.getgr_bufsize = db.header.getgr_bufsize,
|
.getgr_bufsize = db.header.getgr_bufsize,
|
||||||
.getpw_bufsize = db.header.getpw_bufsize,
|
.getpw_bufsize = db.header.getpw_bufsize,
|
||||||
@ -131,8 +131,8 @@ fn execute(
|
|||||||
\\Version: {[version]d}
|
\\Version: {[version]d}
|
||||||
\\Endian: {[endian]s}
|
\\Endian: {[endian]s}
|
||||||
\\Pointer size: {[ptr_size]} bytes
|
\\Pointer size: {[ptr_size]} bytes
|
||||||
\\getgr buffer size: {[getgr_bufsize]d}B
|
\\getgr buffer size: {[getgr_bufsize]d}
|
||||||
\\getpw buffer size: {[getpw_bufsize]d}B
|
\\getpw buffer size: {[getpw_bufsize]d}
|
||||||
\\Users: {[users]d}
|
\\Users: {[users]d}
|
||||||
\\Groups: {[groups]d}
|
\\Groups: {[groups]d}
|
||||||
\\Shells: {[shells]d}
|
\\Shells: {[shells]d}
|
||||||
@ -147,7 +147,7 @@ fn execute(
|
|||||||
|
|
||||||
inline for (meta.fields(DB.DBNumbers)) |field| {
|
inline for (meta.fields(DB.DBNumbers)) |field| {
|
||||||
const length = @field(lengths, field.name);
|
const length = @field(lengths, field.name);
|
||||||
const size = fmt.bufPrint(scratch[0..], "{:.0}", .{
|
const size = fmt.bufPrint(file_size_scratch[0..], "{:.0}", .{
|
||||||
fmt.fmtIntSizeBin(@intCast(u64, length << section_length_bits)),
|
fmt.fmtIntSizeBin(@intCast(u64, length << section_length_bits)),
|
||||||
}) catch unreachable;
|
}) catch unreachable;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user