Function parse_long_name

Source
pub fn parse_long_name(i: &[u8]) -> IResult<&[u8], &str>
Expand description

Parse GNU long pathname or linkname.

use tar_parser2::*;

let (_, entries) = parse_tar(&file[..])?;
let mut long_name = None;
for entry in entries {
    if let TypeFlag::GnuLongName = entry.header.typeflag {
        let (_, ln) = parse_long_name(entry.contents)?;
        long_name = Some(ln);
    } else {
        let name = long_name.take().unwrap_or(entry.header.name);
        println!("{}", name);
    }
}