mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 04:27:45 +00:00
address Arcterus comments on uutils/coreutils PR 515
Mostly style things.
This commit is contained in:
parent
1954274700
commit
288179be49
2 changed files with 7 additions and 7 deletions
|
@ -146,6 +146,7 @@ To do
|
||||||
- mktemp
|
- mktemp
|
||||||
- mv (almost done, one more option)
|
- mv (almost done, one more option)
|
||||||
- numfmt
|
- numfmt
|
||||||
|
- od (in progress, needs lots of work)
|
||||||
- pathchk
|
- pathchk
|
||||||
- pinky
|
- pinky
|
||||||
- pr
|
- pr
|
||||||
|
|
13
src/od/od.rs
13
src/od/od.rs
|
@ -39,7 +39,7 @@ pub fn uumain(args: Vec<String>) -> isize {
|
||||||
"BYTES"),
|
"BYTES"),
|
||||||
getopts::optflag("h", "help", "display this help and exit."),
|
getopts::optflag("h", "help", "display this help and exit."),
|
||||||
getopts::optflag("v", "version", "output version information and exit."),
|
getopts::optflag("v", "version", "output version information and exit."),
|
||||||
];
|
];
|
||||||
|
|
||||||
let matches = match getopts::getopts(args.tail(), &opts) {
|
let matches = match getopts::getopts(args.tail(), &opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
|
@ -78,16 +78,15 @@ fn main(radix: Radix, fname: String) {
|
||||||
Ok(n) => {
|
Ok(n) => {
|
||||||
print!("{:07o}", addr);
|
print!("{:07o}", addr);
|
||||||
match radix {
|
match radix {
|
||||||
Radix::Decimal => {
|
Radix::Decimal => {},
|
||||||
},
|
|
||||||
Radix::Octal => {
|
Radix::Octal => {
|
||||||
for b in range(0, n/std::u16::BYTES) {
|
for b in range(0, n / std::u16::BYTES) {
|
||||||
let bs = &bytes[2*b .. 2*b+2];
|
let bs = &bytes[(2 * b) .. (2 * b + 2)];
|
||||||
let p: u16 = (bs[1] as u16) << 8 | bs[0] as u16;
|
let p: u16 = (bs[1] as u16) << 8 | bs[0] as u16;
|
||||||
print!(" {:06o}", p);
|
print!(" {:06o}", p);
|
||||||
}
|
}
|
||||||
if n % std::u16::BYTES == 1 {
|
if n % std::u16::BYTES == 1 {
|
||||||
print!(" {:06o}", bytes[n-1]);
|
print!(" {:06o}", bytes[n - 1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => { }
|
_ => { }
|
||||||
|
@ -109,7 +108,7 @@ fn parse_radix(radix_str: Option<String>) -> Radix {
|
||||||
}
|
}
|
||||||
|
|
||||||
let radix: char = *(st.get(0)
|
let radix: char = *(st.get(0)
|
||||||
.expect("byte string of length 1 lacks a 0th elem")) as char;
|
.expect("byte string of length 1 lacks a 0th elem")) as char;
|
||||||
if radix == 'd' {
|
if radix == 'd' {
|
||||||
Radix::Decimal
|
Radix::Decimal
|
||||||
} else if radix == 'x' {
|
} else if radix == 'x' {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue