2020-06-24 18:02:47 +05:30
|
|
|
use anyhow::Result;
|
|
|
|
use std::fs::OpenOptions;
|
|
|
|
use std::os::unix::fs::OpenOptionsExt;
|
|
|
|
|
|
|
|
use crate::shrink::xml;
|
|
|
|
|
|
|
|
//---------------------------------------
|
|
|
|
|
2020-06-24 18:25:08 +05:30
|
|
|
pub fn shrink(input_file: &str, _output_file: &str) -> Result<()> {
|
2020-06-24 18:02:47 +05:30
|
|
|
let input = OpenOptions::new()
|
|
|
|
.read(true)
|
|
|
|
.write(false)
|
|
|
|
.custom_flags(libc::O_EXCL)
|
|
|
|
.open(input_file)?;
|
|
|
|
|
2020-06-24 18:25:08 +05:30
|
|
|
// let mut visitor = xml::XmlWriter::new(std::io::stdout());
|
|
|
|
let mut visitor = xml::NoopVisitor::new();
|
2020-06-24 18:02:47 +05:30
|
|
|
xml::read(input, &mut visitor)?;
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------
|