Skip to content

Commit

Permalink
Add csc subcommand for Black Sheep TSCs
Browse files Browse the repository at this point in the history
  • Loading branch information
widberg committed Oct 13, 2023
1 parent be06893 commit fee86c8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
18 changes: 18 additions & 0 deletions bff-cli/src/csc.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use std::io;
use std::io::{BufWriter, Read, Write};

use bff::BufReader;

use crate::error::BffCliResult;

pub fn csc() -> BffCliResult<()> {
let stdin = BufReader::new(io::stdin().lock());
let mut stdout = BufWriter::new(io::stdout().lock());

for byte in stdin.bytes() {
let byte = byte?;
stdout.write_all(&[!byte])?;
}

Ok(())
}
3 changes: 3 additions & 0 deletions bff-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use crate::lz::LzAlgorithm;

mod crc32;
mod crc64;
mod csc;
mod error;
mod extract;
mod info;
Expand Down Expand Up @@ -111,6 +112,7 @@ enum Commands {
#[arg(short = 'a', long = "algorithm", default_value_t = LzAlgorithm::Lzrs)]
algorithm: LzAlgorithm,
},
Csc {},
}

#[derive(Parser)]
Expand Down Expand Up @@ -163,5 +165,6 @@ fn main() -> BffCliResult<()> {
character_set,
),
Commands::RoundTrip { bigfile } => round_trip::round_trip(bigfile),
Commands::Csc {} => csc::csc(),
}
}

0 comments on commit fee86c8

Please sign in to comment.