extern struct ar_hdr [src]

Fields

ar_name: [16]u8Member file name, sometimes / terminated.
ar_date: [12]u8File date, decimal seconds since Epoch.
ar_uid: [6]u8User ID, in ASCII format.
ar_gid: [6]u8Group ID, in ASCII format.
ar_mode: [8]u8File mode, in ASCII octal.
ar_size: [10]u8File size, in ASCII decimal.
ar_fmag: [2]u8Always contains ARFMAG.

Members

Source

pub const ar_hdr = extern struct { /// Member file name, sometimes / terminated. ar_name: [16]u8, /// File date, decimal seconds since Epoch. ar_date: [12]u8, /// User ID, in ASCII format. ar_uid: [6]u8, /// Group ID, in ASCII format. ar_gid: [6]u8, /// File mode, in ASCII octal. ar_mode: [8]u8, /// File size, in ASCII decimal. ar_size: [10]u8, /// Always contains ARFMAG. ar_fmag: [2]u8, pub fn date(self: ar_hdr) std.fmt.ParseIntError!u64 { const value = mem.trimRight(u8, &self.ar_date, &[_]u8{0x20}); return std.fmt.parseInt(u64, value, 10); } pub fn size(self: ar_hdr) std.fmt.ParseIntError!u32 { const value = mem.trimRight(u8, &self.ar_size, &[_]u8{0x20}); return std.fmt.parseInt(u32, value, 10); } pub fn isStrtab(self: ar_hdr) bool { return mem.eql(u8, &self.ar_name, STRNAME); } pub fn isSymtab(self: ar_hdr) bool { return mem.eql(u8, &self.ar_name, SYMNAME); } pub fn isSymtab64(self: ar_hdr) bool { return mem.eql(u8, &self.ar_name, SYM64NAME); } pub fn isSymdef(self: ar_hdr) bool { return mem.eql(u8, &self.ar_name, SYMDEFNAME); } pub fn isSymdefSorted(self: ar_hdr) bool { return mem.eql(u8, &self.ar_name, SYMDEFSORTEDNAME); } pub fn name(self: *const ar_hdr) ?[]const u8 { const value = &self.ar_name; if (value[0] == '/') return null; const sentinel = mem.indexOfScalar(u8, value, '/') orelse value.len; return value[0..sentinel]; } pub fn nameOffset(self: ar_hdr) std.fmt.ParseIntError!?u32 { const value = &self.ar_name; if (value[0] != '/') return null; const trimmed = mem.trimRight(u8, value, &[_]u8{0x20}); return try std.fmt.parseInt(u32, trimmed[1..], 10); } }