forked from AbleOS/ableos_userland
56 lines
1.4 KiB
Rust
56 lines
1.4 KiB
Rust
|
#![no_std]
|
||
|
pub const VERSION: versioning::Version = versioning::Version {
|
||
|
major: 0,
|
||
|
minor: 1,
|
||
|
patch: 0,
|
||
|
};
|
||
|
|
||
|
pub struct Header {
|
||
|
pub filename: [char; 100],
|
||
|
pub filemode: [char; 8],
|
||
|
pub user_id: [char; 8],
|
||
|
pub group_id: [char; 8],
|
||
|
pub size: [char; 12],
|
||
|
pub modified_time: [char; 12],
|
||
|
pub checksum: [char; 8],
|
||
|
pub typeflag: char,
|
||
|
}
|
||
|
|
||
|
impl From<[char; 512]> for Header {
|
||
|
fn from(item: [char; 512]) -> Self {
|
||
|
let mut filename: [char; 100] = ['\0'; 100];
|
||
|
filename[..100].clone_from_slice(&item[0..100]);
|
||
|
|
||
|
let mut filemode: [char; 8] = ['\0'; 8];
|
||
|
filemode[..8].clone_from_slice(&item[100..108]);
|
||
|
|
||
|
let mut user_id: [char; 8] = ['\0'; 8];
|
||
|
user_id[..8].clone_from_slice(&item[108..116]);
|
||
|
|
||
|
let mut group_id: [char; 8] = ['\0'; 8];
|
||
|
group_id[..8].clone_from_slice(&item[116..124]);
|
||
|
|
||
|
let mut size: [char; 12] = ['\0'; 12];
|
||
|
size[..12].clone_from_slice(&item[124..136]);
|
||
|
|
||
|
let mut modified_time: [char; 12] = ['\0'; 12];
|
||
|
modified_time[..12].clone_from_slice(&item[136..148]);
|
||
|
|
||
|
let mut checksum: [char; 8] = ['\0'; 8];
|
||
|
checksum[..8].clone_from_slice(&item[148..154]);
|
||
|
|
||
|
let typeflag: char = item[155];
|
||
|
|
||
|
Self {
|
||
|
filename,
|
||
|
filemode,
|
||
|
user_id,
|
||
|
group_id,
|
||
|
size,
|
||
|
modified_time,
|
||
|
checksum,
|
||
|
typeflag,
|
||
|
}
|
||
|
}
|
||
|
}
|