mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
dd: add support for 'b' and 'x' multipliers
Support the suffix 'b' (multiply by 512) and 'x' (multiply by an arbitrary amount) when specifying numeric arguments to dd.
This commit is contained in:
parent
e60b581c38
commit
3fbaa79359
2 changed files with 128 additions and 18 deletions
|
@ -1,4 +1,4 @@
|
|||
// spell-checker:ignore fname, tname, fpath, specfile, testfile, unspec, ifile, ofile, outfile, fullblock, urand, fileio, atoe, atoibm, availible, behaviour, bmax, bremain, btotal, cflags, creat, ctable, ctty, datastructures, doesnt, etoa, fileout, fname, gnudd, iconvflags, nocache, noctty, noerror, nofollow, nolinks, nonblock, oconvflags, outfile, parseargs, rlen, rmax, rposition, rremain, rsofar, rstat, sigusr, sigval, wlen, wstat abcdefghijklm
|
||||
// spell-checker:ignore fname, tname, fpath, specfile, testfile, unspec, ifile, ofile, outfile, fullblock, urand, fileio, atoe, atoibm, availible, behaviour, bmax, bremain, btotal, cflags, creat, ctable, ctty, datastructures, doesnt, etoa, fileout, fname, gnudd, iconvflags, nocache, noctty, noerror, nofollow, nolinks, nonblock, oconvflags, outfile, parseargs, rlen, rmax, rposition, rremain, rsofar, rstat, sigusr, sigval, wlen, wstat abcdefghijklm abcdefghi
|
||||
|
||||
use crate::common::util::*;
|
||||
|
||||
|
@ -178,6 +178,26 @@ fn test_stdin_stdout_count_w_multiplier() {
|
|||
.success();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_b_multiplier() {
|
||||
// "2b" means 2 * 512, which is 1024.
|
||||
new_ucmd!()
|
||||
.args(&["bs=2b", "count=1"])
|
||||
.pipe_in("a".repeat(1025))
|
||||
.succeeds()
|
||||
.stdout_is("a".repeat(1024));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_x_multiplier() {
|
||||
// "2x3" means 2 * 3, which is 6.
|
||||
new_ucmd!()
|
||||
.args(&["bs=2x3", "count=1"])
|
||||
.pipe_in("abcdefghi")
|
||||
.succeeds()
|
||||
.stdout_is("abcdef");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_final_stats_noxfer() {
|
||||
new_ucmd!()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue