Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/fold/fold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ fn fold_file<T: Read>(mut file: BufReader<T>, bytes: bool, spaces: bool, width:
let ncount = routput.chars().fold(0, |out, ch: char| {
out + match ch {
'\t' => 8,
'\x08' => if out > 0 { -1 } else { 0 },
'\x08' => if out > 0 { !0 } else { 0 },
'\r' => return 0,
_ => 1
}
Expand Down
6 changes: 3 additions & 3 deletions src/stdbuf/stdbuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
for i in 1 .. args.len()+1 {
match parse_options(&args[1 .. i], &mut options, &opts) {
Ok(OkMsg::Buffering) => {
command_idx = i - 1;
command_idx = (i as i32) - 1;
break;
},
Ok(OkMsg::Help) => {
Expand All @@ -249,10 +249,10 @@ pub fn uumain(args: Vec<String>) -> i32 {
if command_idx == -1 {
crash!(125, "Invalid options\nTry 'stdbuf --help' for more information.");
}
let ref command_name = args[command_idx];
let ref command_name = args[command_idx as usize];
let mut command = Command::new(command_name);
let (preload_env, libstdbuf) = get_preload_env();
command.args(&args[command_idx + 1 ..]).env(preload_env, libstdbuf);
command.args(&args[(command_idx as usize)+ 1 ..]).env(preload_env, libstdbuf);
set_command_env(&mut command, "_STDBUF_I", options.stdin);
set_command_env(&mut command, "_STDBUF_O", options.stdout);
set_command_env(&mut command, "_STDBUF_E", options.stderr);
Expand Down