Skip to content

Commit

Permalink
bzip2.rs: flush stderr using rust std
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertdev committed Nov 12, 2024
1 parent 021994d commit 2ebaf07
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bzip2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use std::ffi::{c_char, CStr, CString, OsStr};
use std::io::IsTerminal;
use std::io::Write;
use std::mem::zeroed;
use std::path::{Path, PathBuf};
use std::ptr;
Expand All @@ -21,7 +22,6 @@ use libc::{
extern "C" {
static mut stdin: *mut FILE;
static mut stdout: *mut FILE;
static mut stderr: *mut FILE;
}
type Bool = libc::c_uchar;

Expand Down Expand Up @@ -1298,7 +1298,7 @@ unsafe fn compress(name: *mut c_char) {
if verbosity >= 1 as libc::c_int {
eprint!(" {}: ", CStr::from_ptr(inName.as_ptr()).to_string_lossy(),);
pad(inName.as_mut_ptr());
fflush(stderr);
let _ = std::io::stderr().flush();
}
outputHandleJustInCase = outStr;
delete_output_on_interrupt = true;
Expand Down Expand Up @@ -1553,7 +1553,7 @@ unsafe fn uncompress(name: Option<String>) {
if verbosity >= 1 {
eprint!(" {}: ", in_name.display(),);
pad(inName.as_mut_ptr());
fflush(stderr);
let _ = std::io::stderr().flush();
}

/*--- Now the input and output handles are sane. Do the Biz. ---*/
Expand Down Expand Up @@ -1706,7 +1706,7 @@ unsafe fn testf(name: Option<String>) {
if verbosity >= 1 {
eprint!(" {}: ", in_name.display());
pad(inName.as_mut_ptr());
fflush(stderr);
let _ = std::io::stderr().flush();
}
outputHandleJustInCase = std::ptr::null_mut::<FILE>();
let allOK = testStream(inStr);
Expand Down

0 comments on commit 2ebaf07

Please sign in to comment.