mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-31 13:07:46 +00:00
commit
e4b5b8e19c
6 changed files with 7 additions and 7 deletions
|
@ -92,7 +92,7 @@ fn strip_dir(fullname: &str) -> String {
|
||||||
if c == '/' || c == '\\' {
|
if c == '/' || c == '\\' {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
name.push_char(c);
|
name.push(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
name.as_slice().chars().rev().collect()
|
name.as_slice().chars().rev().collect()
|
||||||
|
|
|
@ -40,7 +40,7 @@ fn mkdelim(col: uint, opts: &getopts::Matches) -> String {
|
||||||
fn ensure_nl(line: String) -> String {
|
fn ensure_nl(line: String) -> String {
|
||||||
match line.as_slice().chars().last() {
|
match line.as_slice().chars().last() {
|
||||||
Some('\n') => line,
|
Some('\n') => line,
|
||||||
_ => line.append("\n"),
|
_ => line + "\n",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -201,7 +201,7 @@ fn fold_file<T: io::Reader>(file: BufferedReader<T>, bytes: bool, spaces: bool,
|
||||||
}
|
}
|
||||||
_ => count += 1
|
_ => count += 1
|
||||||
};
|
};
|
||||||
output.push_char(ch);
|
output.push(ch);
|
||||||
}
|
}
|
||||||
if count > 0 {
|
if count > 0 {
|
||||||
print!("{}", output);
|
print!("{}", output);
|
||||||
|
|
|
@ -179,7 +179,7 @@ fn nl<T: Reader> (reader: &mut BufferedReader<T>, settings: &Settings) {
|
||||||
for mut l in reader.lines().map(|r| r.unwrap()) {
|
for mut l in reader.lines().map(|r| r.unwrap()) {
|
||||||
// Sanitize the string. We want to print the newline ourselves.
|
// Sanitize the string. We want to print the newline ourselves.
|
||||||
if l.as_slice().chars().rev().next().unwrap() == '\n' {
|
if l.as_slice().chars().rev().next().unwrap() == '\n' {
|
||||||
l.pop_char();
|
l.pop();
|
||||||
}
|
}
|
||||||
// Next we iterate through the individual chars to see if this
|
// Next we iterate through the individual chars to see if this
|
||||||
// is one of the special lines starting a new "section" in the
|
// is one of the special lines starting a new "section" in the
|
||||||
|
|
|
@ -141,7 +141,7 @@ fn shuf(input: Vec<String>, mode: Mode, repeat: bool, zero: bool, count: uint, o
|
||||||
let mut lines = vec!();
|
let mut lines = vec!();
|
||||||
for line in file.lines() {
|
for line in file.lines() {
|
||||||
let mut line = crash_if_err!(1, line);
|
let mut line = crash_if_err!(1, line);
|
||||||
line.pop_char();
|
line.pop();
|
||||||
lines.push(line);
|
lines.push(line);
|
||||||
}
|
}
|
||||||
lines.into_iter()
|
lines.into_iter()
|
||||||
|
|
|
@ -196,7 +196,7 @@ fn str_prefix(i: uint, width: uint) -> String {
|
||||||
let div = num::pow(26 as uint, w);
|
let div = num::pow(26 as uint, w);
|
||||||
let r = n / div;
|
let r = n / div;
|
||||||
n -= r * div;
|
n -= r * div;
|
||||||
c.push_char(char::from_u32((r as u32) + 97).unwrap());
|
c.push(char::from_u32((r as u32) + 97).unwrap());
|
||||||
}
|
}
|
||||||
c
|
c
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ fn num_prefix(i: uint, width: uint) -> String {
|
||||||
let div = num::pow(10 as uint, w);
|
let div = num::pow(10 as uint, w);
|
||||||
let r = n / div;
|
let r = n / div;
|
||||||
n -= r * div;
|
n -= r * div;
|
||||||
c.push_char(char::from_digit(r, 10).unwrap());
|
c.push(char::from_digit(r, 10).unwrap());
|
||||||
}
|
}
|
||||||
c
|
c
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue