diff --git a/src/uu/dd/src/datastructures.rs b/src/uu/dd/src/datastructures.rs index 42026c5b3..af4a68c98 100644 --- a/src/uu/dd/src/datastructures.rs +++ b/src/uu/dd/src/datastructures.rs @@ -68,18 +68,31 @@ pub struct OConvFlags { /// Stores all Flags that apply to the input pub struct IFlags { + #[allow(dead_code)] pub cio: bool, + #[allow(dead_code)] pub direct: bool, + #[allow(dead_code)] pub directory: bool, + #[allow(dead_code)] pub dsync: bool, + #[allow(dead_code)] pub sync: bool, + #[allow(dead_code)] pub nocache: bool, + #[allow(dead_code)] pub nonblock: bool, + #[allow(dead_code)] pub noatime: bool, + #[allow(dead_code)] pub noctty: bool, + #[allow(dead_code)] pub nofollow: bool, + #[allow(dead_code)] pub nolinks: bool, + #[allow(dead_code)] pub binary: bool, + #[allow(dead_code)] pub text: bool, pub fullblock: bool, pub count_bytes: bool, @@ -89,18 +102,31 @@ pub struct IFlags { /// Stores all Flags that apply to the output pub struct OFlags { pub append: bool, + #[allow(dead_code)] pub cio: bool, + #[allow(dead_code)] pub direct: bool, + #[allow(dead_code)] pub directory: bool, + #[allow(dead_code)] pub dsync: bool, + #[allow(dead_code)] pub sync: bool, + #[allow(dead_code)] pub nocache: bool, + #[allow(dead_code)] pub nonblock: bool, + #[allow(dead_code)] pub noatime: bool, + #[allow(dead_code)] pub noctty: bool, + #[allow(dead_code)] pub nofollow: bool, + #[allow(dead_code)] pub nolinks: bool, + #[allow(dead_code)] pub binary: bool, + #[allow(dead_code)] pub text: bool, pub seek_bytes: bool, } diff --git a/src/uu/dd/src/dd.rs b/src/uu/dd/src/dd.rs index 64bedc828..ee4dc27ff 100644 --- a/src/uu/dd/src/dd.rs +++ b/src/uu/dd/src/dd.rs @@ -42,7 +42,7 @@ use std::sync::{atomic::AtomicUsize, atomic::Ordering, mpsc, Arc}; use std::thread; use std::time; -const SYNTAX: &str = "dd [OPERAND]...\ndd OPTION"; +// const SYNTAX: &str = "dd [OPERAND]...\ndd OPTION"; const ABOUT: &str = "copy, and optionally convert, a file system resource"; const BUF_INIT_BYTE: u8 = 0xDD; const RTN_SUCCESS: i32 = 0; @@ -294,14 +294,12 @@ struct Output { dst: W, obs: usize, cflags: OConvFlags, - oflags: OFlags, } impl Output { fn new(matches: &Matches) -> Result> { let obs = parseargs::parse_obs(matches)?; let cflags = parseargs::parse_conv_flag_output(matches)?; - let oflags = parseargs::parse_oflags(matches)?; let dst = io::stdout(); @@ -309,7 +307,6 @@ impl Output { dst, obs, cflags, - oflags, }) } @@ -396,7 +393,6 @@ impl Output { dst, obs, cflags, - oflags, }) } else { // The following error should only occur if someone diff --git a/src/uu/dd/src/dd_unit_tests/block_unblock_tests.rs b/src/uu/dd/src/dd_unit_tests/block_unblock_tests.rs index f52d68fd0..f475754a5 100644 --- a/src/uu/dd/src/dd_unit_tests/block_unblock_tests.rs +++ b/src/uu/dd/src/dd_unit_tests/block_unblock_tests.rs @@ -39,7 +39,6 @@ macro_rules! make_block_test ( dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(), obs: 512, cflags: DEFAULT_CFO, - oflags: DEFAULT_OFLAGS, }, $spec, format!("./test-resources/FAILED-{}.test", $test_name) @@ -72,7 +71,6 @@ macro_rules! make_unblock_test ( dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(), obs: 512, cflags: DEFAULT_CFO, - oflags: DEFAULT_OFLAGS, }, $spec, format!("./test-resources/FAILED-{}.test", $test_name) diff --git a/src/uu/dd/src/dd_unit_tests/conv_sync_tests.rs b/src/uu/dd/src/dd_unit_tests/conv_sync_tests.rs index 177aee1a5..93ea8e34d 100644 --- a/src/uu/dd/src/dd_unit_tests/conv_sync_tests.rs +++ b/src/uu/dd/src/dd_unit_tests/conv_sync_tests.rs @@ -25,7 +25,6 @@ macro_rules! make_sync_test ( dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(), obs: $obs, cflags: DEFAULT_CFO, - oflags: DEFAULT_OFLAGS, }, $spec, format!("./test-resources/FAILED-{}.test", $test_name) diff --git a/src/uu/dd/src/dd_unit_tests/conversion_tests.rs b/src/uu/dd/src/dd_unit_tests/conversion_tests.rs index e9f17e8d4..96e35445e 100644 --- a/src/uu/dd/src/dd_unit_tests/conversion_tests.rs +++ b/src/uu/dd/src/dd_unit_tests/conversion_tests.rs @@ -18,7 +18,6 @@ macro_rules! make_conv_test ( dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(), obs: 512, cflags: DEFAULT_CFO, - oflags: DEFAULT_OFLAGS, }, $spec, format!("./test-resources/FAILED-{}.test", $test_name) @@ -44,7 +43,6 @@ macro_rules! make_icf_test ( dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(), obs: 512, cflags: DEFAULT_CFO, - oflags: DEFAULT_OFLAGS, }, $spec, format!("./test-resources/FAILED-{}.test", $test_name) @@ -151,7 +149,6 @@ fn all_valid_ascii_ebcdic_ascii_roundtrip_conv_test() { dst: File::create(&tmp_fname_ae).unwrap(), obs: 1024, cflags: DEFAULT_CFO, - oflags: DEFAULT_OFLAGS, }; dd_fileout(i, o).unwrap(); @@ -174,7 +171,6 @@ fn all_valid_ascii_ebcdic_ascii_roundtrip_conv_test() { dst: File::create(&tmp_fname_ea).unwrap(), obs: 1024, cflags: DEFAULT_CFO, - oflags: DEFAULT_OFLAGS, }; dd_fileout(i, o).unwrap(); diff --git a/src/uu/dd/src/dd_unit_tests/mod.rs b/src/uu/dd/src/dd_unit_tests/mod.rs index a1780204c..ee28d4fd9 100644 --- a/src/uu/dd/src/dd_unit_tests/mod.rs +++ b/src/uu/dd/src/dd_unit_tests/mod.rs @@ -37,23 +37,23 @@ const DEFAULT_IFLAGS: IFlags = IFlags { skip_bytes: false, }; -const DEFAULT_OFLAGS: OFlags = OFlags { - append: false, - cio: false, - direct: false, - directory: false, - dsync: false, - sync: false, - nocache: false, - nonblock: false, - noatime: false, - noctty: false, - nofollow: false, - nolinks: false, - binary: false, - text: false, - seek_bytes: false, -}; +// const DEFAULT_OFLAGS: OFlags = OFlags { +// append: false, +// cio: false, +// direct: false, +// directory: false, +// dsync: false, +// sync: false, +// nocache: false, +// nonblock: false, +// noatime: false, +// noctty: false, +// nofollow: false, +// nolinks: false, +// binary: false, +// text: false, +// seek_bytes: false, +// }; struct LazyReader { src: R, @@ -109,7 +109,6 @@ macro_rules! make_spec_test ( dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(), obs: 512, cflags: DEFAULT_CFO, - oflags: DEFAULT_OFLAGS, }, $spec, format!("./test-resources/FAILED-{}.test", $test_name) diff --git a/src/uu/dd/src/dd_unit_tests/sanity_tests.rs b/src/uu/dd/src/dd_unit_tests/sanity_tests.rs index 2024ea12e..e38870d4a 100644 --- a/src/uu/dd/src/dd_unit_tests/sanity_tests.rs +++ b/src/uu/dd/src/dd_unit_tests/sanity_tests.rs @@ -12,7 +12,6 @@ macro_rules! make_io_test ( dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(), obs: $o.obs, cflags: $o.cflags, - oflags: $o.oflags, }, $spec, format!("./test-resources/FAILED-{}.test", $test_name) @@ -60,7 +59,6 @@ make_io_test!( dst: DST_PLACEHOLDER, obs: 1031, cflags: DEFAULT_CFO, - oflags: DEFAULT_OFLAGS, }, File::open("./test-resources/random-5828891cb1230748e146f34223bbd3b5.test").unwrap() ); @@ -81,7 +79,6 @@ make_io_test!( dst: DST_PLACEHOLDER, obs: 521, cflags: DEFAULT_CFO, - oflags: DEFAULT_OFLAGS, }, File::open("./test-resources/random-5828891cb1230748e146f34223bbd3b5.test").unwrap() ); @@ -102,7 +99,6 @@ make_io_test!( dst: DST_PLACEHOLDER, obs: 1024, cflags: DEFAULT_CFO, - oflags: DEFAULT_OFLAGS, }, File::open("./test-resources/deadbeef-18d99661a1de1fc9af21b0ec2cd67ba3.test").unwrap() ); @@ -123,7 +119,6 @@ make_io_test!( dst: DST_PLACEHOLDER, obs: 1031, cflags: DEFAULT_CFO, - oflags: DEFAULT_OFLAGS, }, File::open("./test-resources/deadbeef-18d99661a1de1fc9af21b0ec2cd67ba3.test").unwrap() ); @@ -144,7 +139,6 @@ make_io_test!( dst: DST_PLACEHOLDER, obs: 1031, cflags: DEFAULT_CFO, - oflags: DEFAULT_OFLAGS, }, File::open("./test-resources/gnudd-deadbeef-first-16k.spec").unwrap() ); @@ -165,7 +159,6 @@ make_io_test!( dst: DST_PLACEHOLDER, obs: 1031, cflags: DEFAULT_CFO, - oflags: DEFAULT_OFLAGS, }, File::open("./test-resources/gnudd-deadbeef-first-12345.spec").unwrap() ); @@ -186,7 +179,6 @@ make_io_test!( dst: DST_PLACEHOLDER, obs: 1024, cflags: DEFAULT_CFO, - oflags: DEFAULT_OFLAGS, }, File::open("./test-resources/gnudd-random-first-32k.spec").unwrap() ); @@ -207,7 +199,6 @@ make_io_test!( dst: DST_PLACEHOLDER, obs: 1031, cflags: DEFAULT_CFO, - oflags: DEFAULT_OFLAGS, }, File::open("./test-resources/gnudd-random-first-32k.spec").unwrap() ); @@ -248,7 +239,6 @@ make_io_test!( dst: DST_PLACEHOLDER, obs: 1031, cflags: DEFAULT_CFO, - oflags: DEFAULT_OFLAGS, }, File::open("./test-resources/random-5828891cb1230748e146f34223bbd3b5.test").unwrap() ); diff --git a/src/uu/dd/src/parseargs.rs b/src/uu/dd/src/parseargs.rs index 15bb8d481..cc7a7447b 100644 --- a/src/uu/dd/src/parseargs.rs +++ b/src/uu/dd/src/parseargs.rs @@ -133,18 +133,31 @@ enum Flag { CountBytes, SkipBytes, // Either + #[allow(unused)] Cio, + #[allow(unused)] Direct, + #[allow(unused)] Directory, + #[allow(unused)] Dsync, + #[allow(unused)] Sync, + #[allow(unused)] NoCache, + #[allow(unused)] NonBlock, + #[allow(unused)] NoATime, + #[allow(unused)] NoCtty, + #[allow(unused)] NoFollow, + #[allow(unused)] NoLinks, + #[allow(unused)] Binary, + #[allow(unused)] Text, // Output only Append,