Home | History | Annotate | only in /src/bin/dd
History log of /src/bin/dd
RevisionDateAuthorComments
 1.20 04-Oct-2019  mrg copy libc's swab.c into dd as dd_swab(), and remove the restrict.

our implementation was fine, but the restrict marker is problematic
as gcc 8 is now more strict about checking for restrict issues.

this is the only actual consumer of swab(3) in our tree, though,
besides the test for it. oh well.
 1.19 15-Sep-2019  kamil Drop -D_INCOMPLETE_XOPEN_C063 from dd(1)
 1.18 18-Mar-2015  manu branches: 1.18.16;
Add iflag and oflag operands to dd(1)

Like GNU dd(1) similar operands, iflag and oflag allow specifying the
O_* flags given to open(2) for the input and the output file. The values
are comma-sepratated, lower-case, O_ prefix-stripped constants documented
in open(2).

Since iflag and oflag override default values, specifying oflag means
O_CREATE is not set by default and must be specified explicitely.

Some values do not make sense (e.g.: iflag=directory) but are still used
and will raise a warning. For oflag, values rdonly, rdwr and wronly are
filtered out with a warning (dd(1) attempts open(2) with O_RDWR and
then O_WRONLY on failure).

Specifying oflag=trunc along with (seek, oseek or conv=notrunc) is
contradictory and will raise an error.

iflag and oflag are disabled if building with -DMALLPROG
 1.17 08-Aug-2012  christos branches: 1.17.12;
let the standard rules deal with librumpclient
 1.16 06-Nov-2011  jym Add a new command to dd(1): msgfmt. The command modifies the
output of the information summary returned by dd(1). This can be used
to specify messages in a more usable (or parseable) format like
human-readable values.

My intent is to re-use this for building image files and quick I/O
benchmarking.

Reviewed by tsutsui@ on tech-userlevel. See also
http://mail-index.netbsd.org/tech-userlevel/2010/12/03/msg004179.html

Some examples:

$ dd if=/dev/zero of=/dev/null bs=1m count=1 msgfmt=human
1+0 records in
1+0 records out
1048576 bytes (1,0 MB) transferred in 0.001 secs (1048576000 bytes/sec - 1,0 GB/sec)

$ dd if=/dev/zero of=/dev/null count=1 msgfmt='
> <speed>%E</speed>
> <time>%s</time>
> <bytes>%b</bytes>
> '
<speed>500 KB/sec</speed>
<time>0.001</time>
<bytes>512</bytes>
 1.15 04-Feb-2011  pooka branches: 1.15.4;
Remove the rif/rof options and add rump.dd. This makes usage
consistent with other rump clients. Copying between kernels is
done using the host pipe, e.g.:

dd if=foo rof=bar skip=1 seek=1 => dd if=foo skip=1 | rump.dd of=bar seek=1

Also, the pipe idiom extends to copying between different rump
kernels, e.g.:

env RUMP_SERVER=unix://srv1 rump.dd if=thefile \
| env RUMP_SERVER=unix://srv2 rump.dd of=thefile

Pipe approach suggested by yamt (thanks!)
 1.14 22-Nov-2010  pooka branches: 1.14.2;
extra crunchgen hoops
 1.13 22-Nov-2010  pooka Add two new operands: "rif" and "rof". They operate exactly like
"if" and "of" with the exception that the communicate with a rump
kernel instead of the host kernel.

For example, to write stdout to /tmp/file.txt in a rump kernel namespace:
dd rof=/tmp/file.txt

copy /file1 to /file2 inside a rump kernel:
dd rif=/file1 rof=/file2

copy a snippet from /dev/rmd0d on the rump kernel to the host fs:
dd rif=/dev/rmd0d of=save seek=1000 count=3

Eat that, usermode OS.

(I'll document the operands one I have some manpage to refer to
for rump client use).
 1.12 05-Oct-2007  lukem Convert to using raise_default_signal(3).
 1.11 26-Jun-2005  christos branches: 1.11.10;
sprinkle a little const, and now everything compiles with WARNS=3
 1.10 29-Nov-2002  lukem convert to using strsuftoll(3) from libc
 1.9 02-Feb-2002  lukem .ifdef SMALLPROG, compile with -DNO_CONV and don't compile in conv_tab.o
 1.8 25-Nov-2001  lukem - Use u_longlong_t instead of u_quad_t, u_long, or int for various buffer sizes
- Add strsuftoull(), which parses a number into a u_longlong_t, with
multiplication support, and support for 'g' (GB) and 't' (TB) suffices.
If an error occurs, print to stderr and exit.
Based on get_blk() from args.c and strsufto*() (in other programs)
- Add strsuftoullx(), which acts as per strsuftoull() but returns the
error in the supplied buffer instead (if the returned buffer != "", an
error occurred)
- Replace get_bsz() use with strsuftoull()
- Remove (now) unnecessary argument validation
- Remove unused {f,p,s,t}_stats fields in struct IO
 1.7 25-Nov-2001  lukem - ANSI KNF
- WARNS=2 (mainly converting some "char *" -> "const char *")
 1.6 20-Jul-1997  christos Remove WARNS=1 from all the subdirectory Makefiles, and add it to Makefile.inc
now that all /bin has been cleaned.
 1.5 20-Jul-1997  christos Fix compiler warnings.
Add WARNS=1
 1.4 21-Mar-1995  cgd convert to new RCS id conventions.
 1.3 22-Sep-1994  mycroft Merge 4.4-Lite version.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 04-May-1993  glass branches: 1.1.1;
added dd(1) from ftp.uu.net:bsd-sources; torching GNU dd
 1.1.1.1 22-Sep-1994  mycroft Import original 4.4-Lite version.
 1.11.10.1 06-Nov-2007  matt sync with HEAD
 1.14.2.1 08-Feb-2011  bouyer Sync with HEAD
 1.15.4.2 30-Oct-2012  yamt sync with head
 1.15.4.1 10-Nov-2011  yamt sync with head
 1.17.12.1 26-Mar-2015  martin Pull up following revision(s) (requested by manu in ticket #640):
bin/dd/extern.h: revision 1.23
bin/dd/dd.1: revision 1.26
bin/dd/dd.1: revision 1.27
bin/dd/dd.h: revision 1.16
bin/dd/dd.c: revision 1.50
bin/dd/Makefile: revision 1.18
bin/dd/args.c: revision 1.39
Add iflag and oflag operands to dd(1)

Like GNU dd(1) similar operands, iflag and oflag allow specifying the
O_* flags given to open(2) for the input and the output file. The values
are comma-sepratated, lower-case, O_ prefix-stripped constants documented
in open(2).

Since iflag and oflag override default values, specifying oflag means
O_CREATE is not set by default and must be specified explicitely.
Some values do not make sense (e.g.: iflag=directory) but are still used
and will raise a warning. For oflag, values rdonly, rdwr and wronly are
filtered out with a warning (dd(1) attempts open(2) with O_RDWR and
then O_WRONLY on failure).

Specifying oflag=trunc along with (seek, oseek or conv=notrunc) is
contradictory and will raise an error.

iflag and oflag are disabled if building with -DMALLPROG

New sentence, new line. Fix typos. Bump date for previous.
 1.18.16.3 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.18.16.2 21-Apr-2020  martin Sync with HEAD
 1.18.16.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.43 26-Jan-2024  mlelstv Don't use the signal handler to terminate when nothing is to do (count=0, files=0).

The signal handler tries to raise the signal again, so that a parent can retrieve
the signal from the exit code. Calling the terminate handler with signal code 0
doesn't raise a signal and dd continues with exit(127) making this case an error.
 1.42 14-Jan-2022  christos The "ibm" and "oldibm" tables are identical, because POSIX just
standardised the table from V7. Nobody, including the original authors,
seems to have noticed this. Merge them and update the documentation.
Also fix the odd, inconsistent, spelling of "pre-4.3BSD-Reno").
(From nabijaczleweli)
 1.41 09-Oct-2021  rillig dd: fix lint warnings about effectively discarding 'const'

args.c(153): warning: call to 'bsearch' effectively discards 'const'
from argument [346]
args.c(383): dito
args.c(475): dito

No functional change.
 1.40 30-Jan-2019  mrg adjust the open flags available for dd to match actual reality
of what matters. remove "search" for now, since O_SEARCH has
no backend. document them all.
 1.39 18-Mar-2015  manu branches: 1.39.16;
Add iflag and oflag operands to dd(1)

Like GNU dd(1) similar operands, iflag and oflag allow specifying the
O_* flags given to open(2) for the input and the output file. The values
are comma-sepratated, lower-case, O_ prefix-stripped constants documented
in open(2).

Since iflag and oflag override default values, specifying oflag means
O_CREATE is not set by default and must be specified explicitely.

Some values do not make sense (e.g.: iflag=directory) but are still used
and will raise a warning. For oflag, values rdonly, rdwr and wronly are
filtered out with a warning (dd(1) attempts open(2) with O_RDWR and
then O_WRONLY on failure).

Specifying oflag=trunc along with (seek, oseek or conv=notrunc) is
contradictory and will raise an error.

iflag and oflag are disabled if building with -DMALLPROG
 1.38 17-Jul-2013  christos branches: 1.38.6;
PR/48057: psi: skip and msgfmt cannot be used together. Looks like a pasto;
fixed.
 1.37 07-Nov-2011  jym branches: 1.37.6;
As suggested by Enami, rework the msgfmt logic a bit:
- error out when an unknown specifier is used. Do this in f_msgfmt(),
before dd(1) starts operation.
- allow buffer_write() to flush the internal buffer even when NULL is
passed as parameter.

Some whitespace fixes too.
 1.36 06-Nov-2011  jym Add a new command to dd(1): msgfmt. The command modifies the
output of the information summary returned by dd(1). This can be used
to specify messages in a more usable (or parseable) format like
human-readable values.

My intent is to re-use this for building image files and quick I/O
benchmarking.

Reviewed by tsutsui@ on tech-userlevel. See also
http://mail-index.netbsd.org/tech-userlevel/2010/12/03/msg004179.html

Some examples:

$ dd if=/dev/zero of=/dev/null bs=1m count=1 msgfmt=human
1+0 records in
1+0 records out
1048576 bytes (1,0 MB) transferred in 0.001 secs (1048576000 bytes/sec - 1,0 GB/sec)

$ dd if=/dev/zero of=/dev/null count=1 msgfmt='
> <speed>%E</speed>
> <time>%s</time>
> <bytes>%b</bytes>
> '
<speed>500 KB/sec</speed>
<time>0.001</time>
<bytes>512</bytes>
 1.35 16-Sep-2011  joerg branches: 1.35.2;
Use __dead for the small build too
 1.34 04-Feb-2011  pooka Remove the rif/rof options and add rump.dd. This makes usage
consistent with other rump clients. Copying between kernels is
done using the host pipe, e.g.:

dd if=foo rof=bar skip=1 seek=1 => dd if=foo skip=1 | rump.dd of=bar seek=1

Also, the pipe idiom extends to copying between different rump
kernels, e.g.:

env RUMP_SERVER=unix://srv1 rump.dd if=thefile \
| env RUMP_SERVER=unix://srv2 rump.dd of=thefile

Pipe approach suggested by yamt (thanks!)
 1.33 13-Jan-2011  jym branches: 1.33.2;
No need to cast with bsearch(), it returns a void *. Use __arraycount().
 1.32 22-Dec-2010  enami Add iseek and oseek option as aliases for skip and seek respectively.
These options exist in dd of solaris or svr3. From FreeBSD.
 1.31 22-Dec-2010  enami Copy argument before modifying it so that ps shows entire argument.
From OpenBSD via FreeBSD.
 1.30 14-Dec-2010  pooka Make compile on non-NetBSD.
 1.29 09-Dec-2010  enami Wrap long line.
 1.28 05-Dec-2010  jym Hmm, for 'rof', I believe that C_ROF|C_OF is invalid rather than
C_ROF|C_ROF.

Hi pooka :)
 1.27 22-Nov-2010  pooka Add two new operands: "rif" and "rof". They operate exactly like
"if" and "of" with the exception that the communicate with a rump
kernel instead of the host kernel.

For example, to write stdout to /tmp/file.txt in a rump kernel namespace:
dd rof=/tmp/file.txt

copy /file1 to /file2 inside a rump kernel:
dd rif=/file1 rof=/file2

copy a snippet from /dev/rmd0d on the rump kernel to the host fs:
dd rif=/dev/rmd0d of=save seek=1000 count=3

Eat that, usermode OS.

(I'll document the operands one I have some manpage to refer to
for rump client use).
 1.26 09-Jan-2006  apb In "dd progress=N", let the value of N control how often
to print a "." to stderr. Previously, any non-zero
value behaved like "progress=1".

PR 24300

Approved by christos
 1.25 17-Jan-2004  dbj add support for conv=sparse
inspired by freebsd, although this patch attempts
to avoid some potential bugs in their implementation.
 1.24 17-Jan-2004  dbj Add C_ASCII and C_EBCDIC to list of options which unset C_BS semantics.
Without this fix, the bs option would cause any of the ascii<->ebcdic
conv options to be ignored.
 1.23 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.
 1.22 04-Aug-2003  jschauma As discusses a little while back on tech-userlevel:

If stdout is a tty, use vis(3) to print any filenames to prevent garbage
from being printed if the filename contains control- or other non-printable
characters.

While here, sprinkle some EXIT_FAILURE and NOTREACHED where appropriate.
 1.21 29-Nov-2002  lukem convert to using strsuftoll(3) from libc
 1.20 26-Nov-2001  enami a bit more cosmetic changes.
 1.19 25-Nov-2001  lukem - Use u_longlong_t instead of u_quad_t, u_long, or int for various buffer sizes
- Add strsuftoull(), which parses a number into a u_longlong_t, with
multiplication support, and support for 'g' (GB) and 't' (TB) suffices.
If an error occurs, print to stderr and exit.
Based on get_blk() from args.c and strsufto*() (in other programs)
- Add strsuftoullx(), which acts as per strsuftoull() but returns the
error in the supplied buffer instead (if the returned buffer != "", an
error occurred)
- Replace get_bsz() use with strsuftoull()
- Remove (now) unnecessary argument validation
- Remove unused {f,p,s,t}_stats fields in struct IO
 1.18 25-Nov-2001  lukem fix WARNS=2 for -DNO_CONV
 1.17 25-Nov-2001  lukem - ANSI KNF
- WARNS=2 (mainly converting some "char *" -> "const char *")
 1.16 22-Jul-2001  wiz seperate -> separate
 1.15 28-Apr-2001  ross In the words of Our Fearless Leader, I am "utterly sick" of dd(1)
lying to me about transfer rates. Do some fixed point frobbing to get
stuff like: 2486864 bytes transferred in 0.272 secs (9142882 bytes/sec)
 1.14 29-Jul-1999  hubertf Add "progress=1" switch to show a sign of life by printing a '.' for
every block written to the output file.
 1.13 28-Jul-1998  mycroft Delint.
 1.12 09-Jul-1998  msaitoh "static" should be located at the beginning of declaration.
 1.11 28-Feb-1998  enami Lineup `case' label and `default' label with `switch'.
 1.10 28-Feb-1998  enami Put space after the keyword `switch'.
 1.9 25-Jul-1997  phil Do multiply in lseek calls as off_t arithmetic. This allows for seeks
of more than INT_MAX. Removed Check for INT_MAX as maximum seeks.
Fixes PR 2101.
 1.8 20-Jul-1997  christos Fix compiler warnings.
Add WARNS=1
 1.7 01-Mar-1996  jtc add const qualifier to args and clist tables
 1.6 20-Feb-1996  jtc Re-do change to use const qualifer with conversion tables.

Fixed bug where pre-computed upper/lower case conversion tables were
used. This won't work if user selected a different locale.
 1.5 08-Oct-1995  gwr Add -DNO_CONV to make this smaller in my ramdisk.
 1.4 21-Mar-1995  cgd convert to new RCS id conventions.
 1.3 22-Sep-1994  mycroft Merge 4.4-Lite version.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 04-May-1993  glass branches: 1.1.1;
added dd(1) from ftp.uu.net:bsd-sources; torching GNU dd
 1.1.1.1 22-Sep-1994  mycroft Import original 4.4-Lite version.
 1.33.2.1 08-Feb-2011  bouyer Sync with HEAD
 1.35.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.35.2.1 10-Nov-2011  yamt sync with head
 1.37.6.1 19-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.38.6.1 26-Mar-2015  martin Pull up following revision(s) (requested by manu in ticket #640):
bin/dd/extern.h: revision 1.23
bin/dd/dd.1: revision 1.26
bin/dd/dd.1: revision 1.27
bin/dd/dd.h: revision 1.16
bin/dd/dd.c: revision 1.50
bin/dd/Makefile: revision 1.18
bin/dd/args.c: revision 1.39
Add iflag and oflag operands to dd(1)

Like GNU dd(1) similar operands, iflag and oflag allow specifying the
O_* flags given to open(2) for the input and the output file. The values
are comma-sepratated, lower-case, O_ prefix-stripped constants documented
in open(2).

Since iflag and oflag override default values, specifying oflag means
O_CREATE is not set by default and must be specified explicitely.
Some values do not make sense (e.g.: iflag=directory) but are still used
and will raise a warning. For oflag, values rdonly, rdwr and wronly are
filtered out with a warning (dd(1) attempts open(2) with O_RDWR and
then O_WRONLY on failure).

Specifying oflag=trunc along with (seek, oseek or conv=notrunc) is
contradictory and will raise an error.

iflag and oflag are disabled if building with -DMALLPROG

New sentence, new line. Fix typos. Bump date for previous.
 1.39.16.3 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.39.16.2 21-Apr-2020  martin Sync with HEAD
 1.39.16.1 10-Jun-2019  christos Sync with HEAD
 1.17 07-Aug-2003  agc branches: 1.17.98;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.
 1.16 05-Aug-2003  erh Include stdlib.h so EXIT_FAILURE is defined.
 1.15 04-Aug-2003  jschauma As discusses a little while back on tech-userlevel:

If stdout is a tty, use vis(3) to print any filenames to prevent garbage
from being printed if the filename contains control- or other non-printable
characters.

While here, sprinkle some EXIT_FAILURE and NOTREACHED where appropriate.
 1.14 26-Nov-2001  lukem Replace {u_,}longlong_t usage with {u,}int64_t, as the former has
"issues" and really shouldn't be used outside of the Sun XDR stuff.
Thanks again to Chuck Silvers for reminding me.
 1.13 25-Nov-2001  lukem - Use u_longlong_t instead of u_quad_t, u_long, or int for various buffer sizes
- Add strsuftoull(), which parses a number into a u_longlong_t, with
multiplication support, and support for 'g' (GB) and 't' (TB) suffices.
If an error occurs, print to stderr and exit.
Based on get_blk() from args.c and strsufto*() (in other programs)
- Add strsuftoullx(), which acts as per strsuftoull() but returns the
error in the supplied buffer instead (if the returned buffer != "", an
error occurred)
- Replace get_bsz() use with strsuftoull()
- Remove (now) unnecessary argument validation
- Remove unused {f,p,s,t}_stats fields in struct IO
 1.12 25-Nov-2001  lukem - ANSI KNF
- WARNS=2 (mainly converting some "char *" -> "const char *")
 1.11 28-Apr-2001  ross In the words of Our Fearless Leader, I am "utterly sick" of dd(1)
lying to me about transfer rates. Do some fixed point frobbing to get
stuff like: 2486864 bytes transferred in 0.272 secs (9142882 bytes/sec)
 1.10 16-Jan-2001  cgd avoid C sequence point issues warned about by development version of gcc.
 1.9 07-Jul-2000  itojun errx?/warnx? audit. do not pass variable alone, use %s. idea from openbsd
 1.8 28-Jul-1998  mycroft branches: 1.8.10;
Delint.
 1.7 20-Jul-1997  christos Fix compiler warnings.
Add WARNS=1
 1.6 20-Feb-1996  jtc Re-do change to use const qualifer with conversion tables.

Fixed bug where pre-computed upper/lower case conversion tables were
used. This won't work if user selected a different locale.
 1.5 08-Oct-1995  gwr Add -DNO_CONV to make this smaller in my ramdisk.
 1.4 21-Mar-1995  cgd convert to new RCS id conventions.
 1.3 22-Sep-1994  mycroft Merge 4.4-Lite version.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 04-May-1993  glass branches: 1.1.1;
added dd(1) from ftp.uu.net:bsd-sources; torching GNU dd
 1.1.1.1 22-Sep-1994  mycroft Import original 4.4-Lite version.
 1.8.10.1 27-Jul-2000  itojun pullup (approved by releng-1-5)
printf-like format pedant. do not pass string variable alone. use "%s".
from openbsd.

/cvsroot/basesrc/bin/dd/conv.c 1.8 -> 1.9
/cvsroot/basesrc/bin/cp/cp.c 1.29 -> 1.30
/cvsroot/basesrc/bin/chmod/chmod.c 1.22 -> 1.23
 1.17.98.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.17.98.1 21-Apr-2020  martin Sync with HEAD
 1.10 14-Jan-2022  christos The "ibm" and "oldibm" tables are identical, because POSIX just
standardised the table from V7. Nobody, including the original authors,
seems to have noticed this. Merge them and update the documentation.
Also fix the odd, inconsistent, spelling of "pre-4.3BSD-Reno").
(From nabijaczleweli)
 1.9 07-Aug-2003  agc branches: 1.9.98;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.
 1.8 20-Jul-1997  christos Fix compiler warnings.
Add WARNS=1
 1.7 20-Feb-1996  jtc Re-do change to use const qualifer with conversion tables.

Fixed bug where pre-computed upper/lower case conversion tables were
used. This won't work if user selected a different locale.
 1.6 20-Feb-1996  cgd Previous change (Use const qualifier with conversion tables) is broken.
(1) It won't compile, and (2) there's code in dd.c which actually
does modify (some, all, used?) conversion tables, so they can't _all_ be
const (if any can).
 1.5 19-Feb-1996  jtc Use const qualifier with conversion tables
 1.4 21-Mar-1995  cgd convert to new RCS id conventions.
 1.3 22-Sep-1994  mycroft Merge 4.4-Lite version.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 04-May-1993  glass branches: 1.1.1;
added dd(1) from ftp.uu.net:bsd-sources; torching GNU dd
 1.1.1.1 22-Sep-1994  mycroft Import original 4.4-Lite version.
 1.9.98.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.9.98.1 21-Apr-2020  martin Sync with HEAD
 1.38 14-Jan-2022  christos The "ibm" and "oldibm" tables are identical, because POSIX just
standardised the table from V7. Nobody, including the original authors,
seems to have noticed this. Merge them and update the documentation.
Also fix the odd, inconsistent, spelling of "pre-4.3BSD-Reno").
(From nabijaczleweli)
 1.37 18-May-2021  nia dd.1: add an example of writing a NetBSD image
 1.36 30-Jan-2019  wiz branches: 1.36.6;
Fix typos; use American spelling consistently. Remove an unnecessary macro.
 1.35 30-Jan-2019  mrg adjust the open flags available for dd to match actual reality
of what matters. remove "search" for now, since O_SEARCH has
no backend. document them all.
 1.34 04-Jul-2017  wiz branches: 1.34.6;
Use Ex.
 1.33 03-Jul-2017  wiz Remove workaround for ancient HTML generation code.
 1.32 18-Aug-2016  sevan bump date
 1.31 18-Aug-2016  sevan dd first appeared in V5, not V1
Heads up by Ingo Schwarze
http://www.tuhs.org/cgi-bin/utree.pl?file=V5/usr/source/s1/dd.c
 1.30 11-Aug-2016  sevan Document the version dd first appeared.
Bump date.
 1.29 11-Aug-2016  sevan Pp not required before Bd, picked up by mandoc lint
 1.28 11-Aug-2016  sevan The macro to cross-reference is Xr, not Xt.
Fix typo error picked up by mandoc lint.
 1.27 18-Mar-2015  wiz New sentence, new line. Fix typos. Bump date for previous.
 1.26 18-Mar-2015  manu Add iflag and oflag operands to dd(1)

Like GNU dd(1) similar operands, iflag and oflag allow specifying the
O_* flags given to open(2) for the input and the output file. The values
are comma-sepratated, lower-case, O_ prefix-stripped constants documented
in open(2).

Since iflag and oflag override default values, specifying oflag means
O_CREATE is not set by default and must be specified explicitely.

Some values do not make sense (e.g.: iflag=directory) but are still used
and will raise a warning. For oflag, values rdonly, rdwr and wronly are
filtered out with a warning (dd(1) attempts open(2) with O_RDWR and
then O_WRONLY on failure).

Specifying oflag=trunc along with (seek, oseek or conv=notrunc) is
contradictory and will raise an error.

iflag and oflag are disabled if building with -DMALLPROG
 1.25 20-Jun-2012  wiz branches: 1.25.12;
- sync `SYNOPSIS' with dd.c's `usage' line;
- correct spelling (prepositions).

From Bug Hunting.
 1.24 06-Nov-2011  jym Add a new command to dd(1): msgfmt. The command modifies the
output of the information summary returned by dd(1). This can be used
to specify messages in a more usable (or parseable) format like
human-readable values.

My intent is to re-use this for building image files and quick I/O
benchmarking.

Reviewed by tsutsui@ on tech-userlevel. See also
http://mail-index.netbsd.org/tech-userlevel/2010/12/03/msg004179.html

Some examples:

$ dd if=/dev/zero of=/dev/null bs=1m count=1 msgfmt=human
1+0 records in
1+0 records out
1048576 bytes (1,0 MB) transferred in 0.001 secs (1048576000 bytes/sec - 1,0 GB/sec)

$ dd if=/dev/zero of=/dev/null count=1 msgfmt='
> <speed>%E</speed>
> <time>%s</time>
> <bytes>%b</bytes>
> '
<speed>500 KB/sec</speed>
<time>0.001</time>
<bytes>512</bytes>
 1.23 22-Dec-2010  enami branches: 1.23.6;
Add iseek and oseek option as aliases for skip and seek respectively.
These options exist in dd of solaris or svr3. From FreeBSD.
 1.22 11-Mar-2009  joerg Don't workaround macro argument limit in ancient troff.
 1.21 13-Apr-2007  lukem branches: 1.21.20;
Use IEC 60027-2 prefixes for 2^n based prefixes.
 1.20 12-Jan-2006  wiz Bump date for progress=n description change.
 1.19 09-Jan-2006  apb In "dd progress=N", let the value of N control how often
to print a "." to stderr. Previously, any non-zero
value behaved like "progress=1".

PR 24300

Approved by christos
 1.18 13-Feb-2004  wiz Spell the plural of suffix "suffixes", not "suffices".
Inspired by PR 24400 by Todd Vierling.
 1.17 17-Jan-2004  dbj add support for conv=sparse
inspired by freebsd, although this patch attempts
to avoid some potential bugs in their implementation.
 1.16 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.
 1.15 25-Feb-2003  wiz .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
 1.14 08-Feb-2002  ross Generate <>& symbolically. I'm avoiding .../dist/... directories for now.
 1.13 25-Nov-2001  wiz Drop a space and an unnecessary .Pp.
 1.12 25-Nov-2001  lukem fix conv= description
 1.11 25-Nov-2001  lukem - Use u_longlong_t instead of u_quad_t, u_long, or int for various buffer sizes
- Add strsuftoull(), which parses a number into a u_longlong_t, with
multiplication support, and support for 'g' (GB) and 't' (TB) suffices.
If an error occurs, print to stderr and exit.
Based on get_blk() from args.c and strsufto*() (in other programs)
- Add strsuftoullx(), which acts as per strsuftoull() but returns the
error in the supplied buffer instead (if the returned buffer != "", an
error occurred)
- Replace get_bsz() use with strsuftoull()
- Remove (now) unnecessary argument validation
- Remove unused {f,p,s,t}_stats fields in struct IO
 1.10 04-Sep-2000  kleink For commands and utilities, use EXIT STATUS rather than RETURN VALUES as
appropriate (and documented in mdoc(7)).
 1.9 28-Aug-2000  hubertf Add 'RETURN VALUE' section header.
 1.8 29-Jul-1999  hubertf branches: 1.8.8;
Add "progress=1" switch to show a sign of life by printing a '.' for
every block written to the output file.
 1.7 06-Feb-1998  perry macroize BSD, NetBSD, FreeBSD and misc cleanup
 1.6 20-Oct-1997  enami Fix .Nm usage.
 1.5 21-Mar-1995  cgd convert to new RCS id conventions.
 1.4 23-Jan-1995  hpeyerl ECBDIC->EBCDIC
 1.3 22-Sep-1994  mycroft Merge 4.4-Lite version.
 1.2 01-Aug-1993  mycroft Add RCS indentifiers.
 1.1 04-May-1993  glass branches: 1.1.1;
added dd(1) from ftp.uu.net:bsd-sources; torching GNU dd
 1.1.1.1 22-Sep-1994  mycroft Import original 4.4-Lite version.
 1.8.8.1 28-Aug-2000  hubertf Pull up to netbsd-1-5 branch, OK'd by thorpej:

Log Message:
> Add 'RETURN VALUE' section header.

Files & Revisionis:
> cvs rdiff -r1.19 -r1.20 basesrc/bin/cat/cat.1
> cvs rdiff -r1.12 -r1.13 basesrc/bin/chmod/chmod.1
> cvs rdiff -r1.14 -r1.15 basesrc/bin/cp/cp.1
> cvs rdiff -r1.8 -r1.9 basesrc/bin/dd/dd.1
> cvs rdiff -r1.9 -r1.10 basesrc/bin/echo/echo.1
> cvs rdiff -r1.11 -r1.12 basesrc/bin/expr/expr.1
> cvs rdiff -r1.25 -r1.26 basesrc/bin/ls/ls.1
> cvs rdiff -r1.10 -r1.11 basesrc/bin/mkdir/mkdir.1
> cvs rdiff -r1.23 -r1.24 basesrc/bin/mt/mt.1
> cvs rdiff -r1.12 -r1.13 basesrc/bin/mv/mv.1
> cvs rdiff -r1.16 -r1.17 basesrc/bin/pwd/pwd.1
> cvs rdiff -r1.9 -r1.10 basesrc/bin/rm/rm.1
> cvs rdiff -r1.11 -r1.12 basesrc/bin/rmdir/rmdir.1
> cvs rdiff -r1.35 -r1.36 basesrc/bin/sh/sh.1
> cvs rdiff -r1.11 -r1.12 basesrc/bin/sleep/sleep.1
> cvs rdiff -r1.20 -r1.21 basesrc/bin/stty/stty.1
 1.21.20.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.23.6.2 30-Oct-2012  yamt sync with head
 1.23.6.1 10-Nov-2011  yamt sync with head
 1.25.12.1 26-Mar-2015  martin Pull up following revision(s) (requested by manu in ticket #640):
bin/dd/extern.h: revision 1.23
bin/dd/dd.1: revision 1.26
bin/dd/dd.1: revision 1.27
bin/dd/dd.h: revision 1.16
bin/dd/dd.c: revision 1.50
bin/dd/Makefile: revision 1.18
bin/dd/args.c: revision 1.39
Add iflag and oflag operands to dd(1)

Like GNU dd(1) similar operands, iflag and oflag allow specifying the
O_* flags given to open(2) for the input and the output file. The values
are comma-sepratated, lower-case, O_ prefix-stripped constants documented
in open(2).

Since iflag and oflag override default values, specifying oflag means
O_CREATE is not set by default and must be specified explicitely.
Some values do not make sense (e.g.: iflag=directory) but are still used
and will raise a warning. For oflag, values rdonly, rdwr and wronly are
filtered out with a warning (dd(1) attempts open(2) with O_RDWR and
then O_WRONLY on failure).

Specifying oflag=trunc along with (seek, oseek or conv=notrunc) is
contradictory and will raise an error.

iflag and oflag are disabled if building with -DMALLPROG

New sentence, new line. Fix typos. Bump date for previous.
 1.34.6.3 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.34.6.2 21-Apr-2020  martin Sync with HEAD
 1.34.6.1 10-Jun-2019  christos Sync with HEAD
 1.36.6.1 31-May-2021  cjep sync with head
 1.53 04-Oct-2019  mrg copy libc's swab.c into dd as dd_swab(), and remove the restrict.

our implementation was fine, but the restrict marker is problematic
as gcc 8 is now more strict about checking for restrict issues.

this is the only actual consumer of swab(3) in our tree, though,
besides the test for it. oh well.
 1.52 23-Mar-2019  mlelstv When buffers are at least page sized, explicitely request page alignment.
 1.51 05-Sep-2016  sevan branches: 1.51.14;
Drop main() prototype.
 1.50 18-Mar-2015  manu Add iflag and oflag operands to dd(1)

Like GNU dd(1) similar operands, iflag and oflag allow specifying the
O_* flags given to open(2) for the input and the output file. The values
are comma-sepratated, lower-case, O_ prefix-stripped constants documented
in open(2).

Since iflag and oflag override default values, specifying oflag means
O_CREATE is not set by default and must be specified explicitely.

Some values do not make sense (e.g.: iflag=directory) but are still used
and will raise a warning. For oflag, values rdonly, rdwr and wronly are
filtered out with a warning (dd(1) attempts open(2) with O_RDWR and
then O_WRONLY on failure).

Specifying oflag=trunc along with (seek, oseek or conv=notrunc) is
contradictory and will raise an error.

iflag and oflag are disabled if building with -DMALLPROG
 1.49 21-Feb-2012  matt branches: 1.49.12;
Fix a very old bug. When allocating the buffer and doing just a bs= transfer,
hen we only need a single buffer equal to that blocksize in length.
 1.48 06-Nov-2011  jym Add a new command to dd(1): msgfmt. The command modifies the
output of the information summary returned by dd(1). This can be used
to specify messages in a more usable (or parseable) format like
human-readable values.

My intent is to re-use this for building image files and quick I/O
benchmarking.

Reviewed by tsutsui@ on tech-userlevel. See also
http://mail-index.netbsd.org/tech-userlevel/2010/12/03/msg004179.html

Some examples:

$ dd if=/dev/zero of=/dev/null bs=1m count=1 msgfmt=human
1+0 records in
1+0 records out
1048576 bytes (1,0 MB) transferred in 0.001 secs (1048576000 bytes/sec - 1,0 GB/sec)

$ dd if=/dev/zero of=/dev/null count=1 msgfmt='
> <speed>%E</speed>
> <time>%s</time>
> <bytes>%b</bytes>
> '
<speed>500 KB/sec</speed>
<time>0.001</time>
<bytes>512</bytes>
 1.47 04-Feb-2011  pooka branches: 1.47.4;
Remove the rif/rof options and add rump.dd. This makes usage
consistent with other rump clients. Copying between kernels is
done using the host pipe, e.g.:

dd if=foo rof=bar skip=1 seek=1 => dd if=foo skip=1 | rump.dd of=bar seek=1

Also, the pipe idiom extends to copying between different rump
kernels, e.g.:

env RUMP_SERVER=unix://srv1 rump.dd if=thefile \
| env RUMP_SERVER=unix://srv2 rump.dd of=thefile

Pipe approach suggested by yamt (thanks!)
 1.46 23-Dec-2010  riz branches: 1.46.2;
Fix speling ("deferred," not "defered") as reported in #netbsd-code on
freenode IRC. While I'm here, clean up the wording later in the comment.
 1.45 14-Dec-2010  pooka remove some leftover development garbage
 1.44 22-Nov-2010  pooka Add two new operands: "rif" and "rof". They operate exactly like
"if" and "of" with the exception that the communicate with a rump
kernel instead of the host kernel.

For example, to write stdout to /tmp/file.txt in a rump kernel namespace:
dd rof=/tmp/file.txt

copy /file1 to /file2 inside a rump kernel:
dd rif=/file1 rof=/file2

copy a snippet from /dev/rmd0d on the rump kernel to the host fs:
dd rif=/dev/rmd0d of=save seek=1000 count=3

Eat that, usermode OS.

(I'll document the operands one I have some manpage to refer to
for rump client use).
 1.43 14-Feb-2009  lukem fix -Wsign-compare issues
 1.42 20-Jul-2008  lukem branches: 1.42.6; 1.42.10;
Remove the \n and tabs from the __COPYRIGHT() strings.
 1.41 26-May-2008  christos PR/38755: murray armfield: /bin posix programs missing setprogname and/or
setlocale
 1.40 29-Apr-2007  msaitoh branches: 1.40.10; 1.40.12;
fix typos
 1.39 09-Jan-2006  apb In "dd progress=N", let the value of N control how often
to print a "." to stderr. Previously, any non-zero
value behaved like "progress=1".

PR 24300

Approved by christos
 1.38 20-Apr-2005  rillig Fixed an off-by-one error with ASCII <-> EBCDIC conversion combined with
lcase/ucase. Approved by mrg.
 1.37 17-Jan-2004  dbj minor nit, set out.dbp correctly when constructing final null block
for sparse files.
 1.36 17-Jan-2004  dbj add support for conv=sparse
inspired by freebsd, although this patch attempts
to avoid some potential bugs in their implementation.
 1.35 15-Nov-2003  dsainty Optimise previous change, using fcntl(F_DUPFD) to locate a free descriptor
for us, rather than iterating until satisfied.

Suggested by David Laight.
 1.34 15-Nov-2003  dsainty Avoid corrupting the dd(1) IO streams. This would happen by accidentally
outputting to the files being manipulated by opening a file in the standard IO
descriptor space. In particular, an output file unlucky enough to be sitting
on descriptor 2 (stderr) is certain to be corrupted.

Addresses PR bin/8521, and passes the recently committed regression test
"bin/dd".
 1.33 14-Sep-2003  jschauma Following private discussion with kleink@ and hubertf@ and public discussion
on tech-userlevel@, back out printescaped() functionality.
kleink: ``We sell rope.''
 1.32 20-Aug-2003  jschauma Fix memory leak noted by Hubert Feyrer in private email.
Patch by Hubert Feyrer as well, OK by kleink.
(I'm just fixing it b/c it's my fault to begin with.)
 1.31 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.
 1.30 04-Aug-2003  jschauma As discusses a little while back on tech-userlevel:

If stdout is a tty, use vis(3) to print any filenames to prevent garbage
from being printed if the filename contains control- or other non-printable
characters.

While here, sprinkle some EXIT_FAILURE and NOTREACHED where appropriate.
 1.29 04-Sep-2002  enami Add comment about my rev. 1.27 change.
 1.28 03-Sep-2002  tron Ignore EINVAL returned from fsync(2) because it is the expected error code
if we try to use it on a pipe.
 1.27 01-Sep-2002  enami Detect the last nfs write error.
 1.26 10-Jan-2002  lukem Convert some variables that were signed ints before my update to 64 bit sizes
from uint64_t to int64_t. Fixes [bin/15187]
 1.25 26-Nov-2001  enami a bit more cosmetic changes.
 1.24 26-Nov-2001  lukem Replace {u_,}longlong_t usage with {u,}int64_t, as the former has
"issues" and really shouldn't be used outside of the Sun XDR stuff.
Thanks again to Chuck Silvers for reminding me.
 1.23 25-Nov-2001  lukem - Use u_longlong_t instead of u_quad_t, u_long, or int for various buffer sizes
- Add strsuftoull(), which parses a number into a u_longlong_t, with
multiplication support, and support for 'g' (GB) and 't' (TB) suffices.
If an error occurs, print to stderr and exit.
Based on get_blk() from args.c and strsufto*() (in other programs)
- Add strsuftoullx(), which acts as per strsuftoull() but returns the
error in the supplied buffer instead (if the returned buffer != "", an
error occurred)
- Replace get_bsz() use with strsuftoull()
- Remove (now) unnecessary argument validation
- Remove unused {f,p,s,t}_stats fields in struct IO
 1.22 25-Nov-2001  lukem fix WARNS=2 for -DNO_CONV
 1.21 25-Nov-2001  lukem - ANSI KNF
- WARNS=2 (mainly converting some "char *" -> "const char *")
 1.20 28-Apr-2001  ross In the words of Our Fearless Leader, I am "utterly sick" of dd(1)
lying to me about transfer rates. Do some fixed point frobbing to get
stuff like: 2486864 bytes transferred in 0.272 secs (9142882 bytes/sec)
 1.19 25-Oct-2000  kleink KNF nit in previous.
 1.18 16-Oct-2000  kleink Make sure we accept the getopt(3) 'last option' delimiter;
fixes PR standards/11229.
 1.17 25-Aug-2000  matt Fix conv=swab. Don't swab the entire input buffer every time we read
another block, just swab the block we just read.
 1.16 02-Aug-2000  christos rename nset to infoset from jhawk.
 1.15 02-Aug-2000  christos block siginfo during writes.
 1.14 09-Nov-1999  drochner branches: 1.14.4;
Since our gcc doesn't warn about NULL format strings anymore, we can
fix the incorrect err(1, "%s", "") et al.
Closes PR bin/7592 by cgd.
 1.13 29-Jul-1999  hubertf branches: 1.13.4;
Add "progress=1" switch to show a sign of life by printing a '.' for
every block written to the output file.
 1.12 19-Aug-1998  thorpej Add some braces to make egcs happy.
 1.11 28-Jul-1998  mycroft Delint.
 1.10 28-Jul-1998  mycroft Delint.
 1.9 29-Jun-1998  gwr Fix a minor bug that made conv=sync pad partial blocks with garbage,
when it is supposd to pad with zero or space as with osync.
 1.8 01-Apr-1998  kleink Need <time.h> fo time() prototype.
 1.7 20-Jul-1997  christos Fix compiler warnings.
Add WARNS=1
 1.6 20-Feb-1996  jtc Re-do change to use const qualifer with conversion tables.

Fixed bug where pre-computed upper/lower case conversion tables were
used. This won't work if user selected a different locale.
 1.5 08-Oct-1995  gwr Add -DNO_CONV to make this smaller in my ramdisk.
 1.4 21-Mar-1995  cgd convert to new RCS id conventions.
 1.3 22-Sep-1994  mycroft Merge 4.4-Lite version.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 04-May-1993  glass branches: 1.1.1;
added dd(1) from ftp.uu.net:bsd-sources; torching GNU dd
 1.1.1.1 22-Sep-1994  mycroft Import original 4.4-Lite version.
 1.13.4.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.14.4.2 03-Feb-2001  he Pull up revisions 1.18-1.19 (requested by kleink):
Accept the getopt(3) ``last option'' delimiter. Fixes PR#11229.
 1.14.4.1 26-Aug-2000  matt Pull up dd.c 1.17, extern.h 1.10, position 1.9. approved by thorpej:
>fix conv=swap when ibs!=obs
>block SIGINFO when writing
 1.40.12.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.40.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.40.10.1 04-Jun-2008  yamt sync with head
 1.42.10.1 24-Feb-2012  matt pull in revision 1.49:
Fix a very old bug. When allocating the buffer and doing just a bs= transfer,
hen we only need a single buffer equal to that blocksize in length.
 1.42.6.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.46.2.1 08-Feb-2011  bouyer Sync with HEAD
 1.47.4.2 17-Apr-2012  yamt sync with head
 1.47.4.1 10-Nov-2011  yamt sync with head
 1.49.12.1 26-Mar-2015  martin Pull up following revision(s) (requested by manu in ticket #640):
bin/dd/extern.h: revision 1.23
bin/dd/dd.1: revision 1.26
bin/dd/dd.1: revision 1.27
bin/dd/dd.h: revision 1.16
bin/dd/dd.c: revision 1.50
bin/dd/Makefile: revision 1.18
bin/dd/args.c: revision 1.39
Add iflag and oflag operands to dd(1)

Like GNU dd(1) similar operands, iflag and oflag allow specifying the
O_* flags given to open(2) for the input and the output file. The values
are comma-sepratated, lower-case, O_ prefix-stripped constants documented
in open(2).

Since iflag and oflag override default values, specifying oflag means
O_CREATE is not set by default and must be specified explicitely.
Some values do not make sense (e.g.: iflag=directory) but are still used
and will raise a warning. For oflag, values rdonly, rdwr and wronly are
filtered out with a warning (dd(1) attempts open(2) with O_RDWR and
then O_WRONLY on failure).

Specifying oflag=trunc along with (seek, oseek or conv=notrunc) is
contradictory and will raise an error.

iflag and oflag are disabled if building with -DMALLPROG

New sentence, new line. Fix typos. Bump date for previous.
 1.51.14.4 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.51.14.3 21-Apr-2020  martin Sync with HEAD
 1.51.14.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.51.14.1 10-Jun-2019  christos Sync with HEAD
 1.16 18-Mar-2015  manu branches: 1.16.16;
Add iflag and oflag operands to dd(1)

Like GNU dd(1) similar operands, iflag and oflag allow specifying the
O_* flags given to open(2) for the input and the output file. The values
are comma-sepratated, lower-case, O_ prefix-stripped constants documented
in open(2).

Since iflag and oflag override default values, specifying oflag means
O_CREATE is not set by default and must be specified explicitely.

Some values do not make sense (e.g.: iflag=directory) but are still used
and will raise a warning. For oflag, values rdonly, rdwr and wronly are
filtered out with a warning (dd(1) attempts open(2) with O_RDWR and
then O_WRONLY on failure).

Specifying oflag=trunc along with (seek, oseek or conv=notrunc) is
contradictory and will raise an error.

iflag and oflag are disabled if building with -DMALLPROG
 1.15 04-Feb-2011  pooka branches: 1.15.24;
Remove the rif/rof options and add rump.dd. This makes usage
consistent with other rump clients. Copying between kernels is
done using the host pipe, e.g.:

dd if=foo rof=bar skip=1 seek=1 => dd if=foo skip=1 | rump.dd of=bar seek=1

Also, the pipe idiom extends to copying between different rump
kernels, e.g.:

env RUMP_SERVER=unix://srv1 rump.dd if=thefile \
| env RUMP_SERVER=unix://srv2 rump.dd of=thefile

Pipe approach suggested by yamt (thanks!)
 1.14 06-Dec-2010  pooka branches: 1.14.2;
Fix most inopportune typo. from gson & jmmv.
 1.13 22-Nov-2010  pooka Add two new operands: "rif" and "rof". They operate exactly like
"if" and "of" with the exception that the communicate with a rump
kernel instead of the host kernel.

For example, to write stdout to /tmp/file.txt in a rump kernel namespace:
dd rof=/tmp/file.txt

copy /file1 to /file2 inside a rump kernel:
dd rif=/file1 rof=/file2

copy a snippet from /dev/rmd0d on the rump kernel to the host fs:
dd rif=/dev/rmd0d of=save seek=1000 count=3

Eat that, usermode OS.

(I'll document the operands one I have some manpage to refer to
for rump client use).
 1.12 17-Jan-2004  dbj add support for conv=sparse
inspired by freebsd, although this patch attempts
to avoid some potential bugs in their implementation.
 1.11 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.
 1.10 10-Jan-2002  lukem Convert some variables that were signed ints before my update to 64 bit sizes
from uint64_t to int64_t. Fixes [bin/15187]
 1.9 26-Nov-2001  lukem Replace {u_,}longlong_t usage with {u,}int64_t, as the former has
"issues" and really shouldn't be used outside of the Sun XDR stuff.
Thanks again to Chuck Silvers for reminding me.
 1.8 25-Nov-2001  lukem - Use u_longlong_t instead of u_quad_t, u_long, or int for various buffer sizes
- Add strsuftoull(), which parses a number into a u_longlong_t, with
multiplication support, and support for 'g' (GB) and 't' (TB) suffices.
If an error occurs, print to stderr and exit.
Based on get_blk() from args.c and strsufto*() (in other programs)
- Add strsuftoullx(), which acts as per strsuftoull() but returns the
error in the supplied buffer instead (if the returned buffer != "", an
error occurred)
- Replace get_bsz() use with strsuftoull()
- Remove (now) unnecessary argument validation
- Remove unused {f,p,s,t}_stats fields in struct IO
 1.7 25-Nov-2001  lukem - ANSI KNF
- WARNS=2 (mainly converting some "char *" -> "const char *")
 1.6 28-Apr-2001  ross In the words of Our Fearless Leader, I am "utterly sick" of dd(1)
lying to me about transfer rates. Do some fixed point frobbing to get
stuff like: 2486864 bytes transferred in 0.272 secs (9142882 bytes/sec)
 1.5 04-Feb-1998  enami Use u_quad_t instead of u_long to define struct STAT.bytes, which
is used to count bytes transfered, so that it won't overflow even if
transfer is more than 4Gbytes.
 1.4 21-Mar-1995  cgd convert to new RCS id conventions.
 1.3 22-Sep-1994  mycroft Merge 4.4-Lite version.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 04-May-1993  glass branches: 1.1.1;
added dd(1) from ftp.uu.net:bsd-sources; torching GNU dd
 1.1.1.1 22-Sep-1994  mycroft Import original 4.4-Lite version.
 1.14.2.1 08-Feb-2011  bouyer Sync with HEAD
 1.15.24.1 26-Mar-2015  martin Pull up following revision(s) (requested by manu in ticket #640):
bin/dd/extern.h: revision 1.23
bin/dd/dd.1: revision 1.26
bin/dd/dd.1: revision 1.27
bin/dd/dd.h: revision 1.16
bin/dd/dd.c: revision 1.50
bin/dd/Makefile: revision 1.18
bin/dd/args.c: revision 1.39
Add iflag and oflag operands to dd(1)

Like GNU dd(1) similar operands, iflag and oflag allow specifying the
O_* flags given to open(2) for the input and the output file. The values
are comma-sepratated, lower-case, O_ prefix-stripped constants documented
in open(2).

Since iflag and oflag override default values, specifying oflag means
O_CREATE is not set by default and must be specified explicitely.
Some values do not make sense (e.g.: iflag=directory) but are still used
and will raise a warning. For oflag, values rdonly, rdwr and wronly are
filtered out with a warning (dd(1) attempts open(2) with O_RDWR and
then O_WRONLY on failure).

Specifying oflag=trunc along with (seek, oseek or conv=notrunc) is
contradictory and will raise an error.

iflag and oflag are disabled if building with -DMALLPROG

New sentence, new line. Fix typos. Bump date for previous.
 1.16.16.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.16.16.1 21-Apr-2020  martin Sync with HEAD
 1.1 04-Feb-2011  pooka branches: 1.1.2; 1.1.48;
Remove the rif/rof options and add rump.dd. This makes usage
consistent with other rump clients. Copying between kernels is
done using the host pipe, e.g.:

dd if=foo rof=bar skip=1 seek=1 => dd if=foo skip=1 | rump.dd of=bar seek=1

Also, the pipe idiom extends to copying between different rump
kernels, e.g.:

env RUMP_SERVER=unix://srv1 rump.dd if=thefile \
| env RUMP_SERVER=unix://srv2 rump.dd of=thefile

Pipe approach suggested by yamt (thanks!)
 1.1.48.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.1.48.1 21-Apr-2020  martin Sync with HEAD
 1.1.2.2 08-Feb-2011  bouyer Sync with HEAD
 1.1.2.1 04-Feb-2011  bouyer file dd_hostops.c was added on branch bouyer-quota2 on 2011-02-08 16:18:27 +0000
 1.1 04-Feb-2011  pooka branches: 1.1.2; 1.1.48;
Remove the rif/rof options and add rump.dd. This makes usage
consistent with other rump clients. Copying between kernels is
done using the host pipe, e.g.:

dd if=foo rof=bar skip=1 seek=1 => dd if=foo skip=1 | rump.dd of=bar seek=1

Also, the pipe idiom extends to copying between different rump
kernels, e.g.:

env RUMP_SERVER=unix://srv1 rump.dd if=thefile \
| env RUMP_SERVER=unix://srv2 rump.dd of=thefile

Pipe approach suggested by yamt (thanks!)
 1.1.48.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.1.48.1 21-Apr-2020  martin Sync with HEAD
 1.1.2.2 08-Feb-2011  bouyer Sync with HEAD
 1.1.2.1 04-Feb-2011  bouyer file dd_rumpops.c was added on branch bouyer-quota2 on 2011-02-08 16:18:27 +0000
 1.2 08-Oct-2021  christos PR/56443: RVP: dd conv=swab doesn't always work
 1.1 04-Oct-2019  mrg branches: 1.1.4;
copy libc's swab.c into dd as dd_swab(), and remove the restrict.

our implementation was fine, but the restrict marker is problematic
as gcc 8 is now more strict about checking for restrict issues.

this is the only actual consumer of swab(3) in our tree, though,
besides the test for it. oh well.
 1.1.4.4 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.1.4.3 21-Apr-2020  martin Sync with HEAD
 1.1.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1.4.1 04-Oct-2019  martin file dd_swab.c was added on branch phil-wifi on 2020-04-13 07:45:05 +0000
 1.25 14-Jan-2022  christos update header too.
 1.24 04-Oct-2019  mrg copy libc's swab.c into dd as dd_swab(), and remove the restrict.

our implementation was fine, but the restrict marker is problematic
as gcc 8 is now more strict about checking for restrict issues.

this is the only actual consumer of swab(3) in our tree, though,
besides the test for it. oh well.
 1.23 18-Mar-2015  manu branches: 1.23.16;
Add iflag and oflag operands to dd(1)

Like GNU dd(1) similar operands, iflag and oflag allow specifying the
O_* flags given to open(2) for the input and the output file. The values
are comma-sepratated, lower-case, O_ prefix-stripped constants documented
in open(2).

Since iflag and oflag override default values, specifying oflag means
O_CREATE is not set by default and must be specified explicitely.

Some values do not make sense (e.g.: iflag=directory) but are still used
and will raise a warning. For oflag, values rdonly, rdwr and wronly are
filtered out with a warning (dd(1) attempts open(2) with O_RDWR and
then O_WRONLY on failure).

Specifying oflag=trunc along with (seek, oseek or conv=notrunc) is
contradictory and will raise an error.

iflag and oflag are disabled if building with -DMALLPROG
 1.22 07-Nov-2011  jym branches: 1.22.20;
As suggested by Enami, rework the msgfmt logic a bit:
- error out when an unknown specifier is used. Do this in f_msgfmt(),
before dd(1) starts operation.
- allow buffer_write() to flush the internal buffer even when NULL is
passed as parameter.

Some whitespace fixes too.
 1.21 06-Nov-2011  jym Add a new command to dd(1): msgfmt. The command modifies the
output of the information summary returned by dd(1). This can be used
to specify messages in a more usable (or parseable) format like
human-readable values.

My intent is to re-use this for building image files and quick I/O
benchmarking.

Reviewed by tsutsui@ on tech-userlevel. See also
http://mail-index.netbsd.org/tech-userlevel/2010/12/03/msg004179.html

Some examples:

$ dd if=/dev/zero of=/dev/null bs=1m count=1 msgfmt=human
1+0 records in
1+0 records out
1048576 bytes (1,0 MB) transferred in 0.001 secs (1048576000 bytes/sec - 1,0 GB/sec)

$ dd if=/dev/zero of=/dev/null count=1 msgfmt='
> <speed>%E</speed>
> <time>%s</time>
> <bytes>%b</bytes>
> '
<speed>500 KB/sec</speed>
<time>0.001</time>
<bytes>512</bytes>
 1.20 16-Sep-2011  joerg branches: 1.20.2;
Use __dead for the small build too
 1.19 29-Aug-2011  joerg Use __dead
 1.18 22-Nov-2010  pooka Add two new operands: "rif" and "rof". They operate exactly like
"if" and "of" with the exception that the communicate with a rump
kernel instead of the host kernel.

For example, to write stdout to /tmp/file.txt in a rump kernel namespace:
dd rof=/tmp/file.txt

copy /file1 to /file2 inside a rump kernel:
dd rif=/file1 rof=/file2

copy a snippet from /dev/rmd0d on the rump kernel to the host fs:
dd rif=/dev/rmd0d of=save seek=1000 count=3

Eat that, usermode OS.

(I'll document the operands one I have some manpage to refer to
for rump client use).
 1.17 09-Jan-2006  apb In "dd progress=N", let the value of N control how often
to print a "." to stderr. Previously, any non-zero
value behaved like "progress=1".

PR 24300

Approved by christos
 1.16 14-Sep-2003  jschauma Following private discussion with kleink@ and hubertf@ and public discussion
on tech-userlevel@, back out printescaped() functionality.
kleink: ``We sell rope.''
 1.15 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.
 1.14 04-Aug-2003  jschauma As discusses a little while back on tech-userlevel:

If stdout is a tty, use vis(3) to print any filenames to prevent garbage
from being printed if the filename contains control- or other non-printable
characters.

While here, sprinkle some EXIT_FAILURE and NOTREACHED where appropriate.
 1.13 26-Nov-2001  lukem Replace {u_,}longlong_t usage with {u,}int64_t, as the former has
"issues" and really shouldn't be used outside of the Sun XDR stuff.
Thanks again to Chuck Silvers for reminding me.
 1.12 25-Nov-2001  lukem - Use u_longlong_t instead of u_quad_t, u_long, or int for various buffer sizes
- Add strsuftoull(), which parses a number into a u_longlong_t, with
multiplication support, and support for 'g' (GB) and 't' (TB) suffices.
If an error occurs, print to stderr and exit.
Based on get_blk() from args.c and strsufto*() (in other programs)
- Add strsuftoullx(), which acts as per strsuftoull() but returns the
error in the supplied buffer instead (if the returned buffer != "", an
error occurred)
- Replace get_bsz() use with strsuftoull()
- Remove (now) unnecessary argument validation
- Remove unused {f,p,s,t}_stats fields in struct IO
 1.11 25-Nov-2001  lukem - ANSI KNF
- WARNS=2 (mainly converting some "char *" -> "const char *")
 1.10 02-Aug-2000  christos block siginfo during writes.
 1.9 29-Jul-1999  hubertf branches: 1.9.8;
Add "progress=1" switch to show a sign of life by printing a '.' for
every block written to the output file.
 1.8 20-Jul-1997  christos Fix compiler warnings.
Add WARNS=1
 1.7 20-Feb-1996  jtc Re-do change to use const qualifer with conversion tables.

Fixed bug where pre-computed upper/lower case conversion tables were
used. This won't work if user selected a different locale.
 1.6 20-Feb-1996  cgd Previous change (Use const qualifier with conversion tables) is broken.
(1) It won't compile, and (2) there's code in dd.c which actually
does modify (some, all, used?) conversion tables, so they can't _all_ be
const (if any can).
 1.5 19-Feb-1996  jtc Use const qualifier with conversion tables
 1.4 21-Mar-1995  cgd convert to new RCS id conventions.
 1.3 22-Sep-1994  mycroft Merge 4.4-Lite version.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 04-May-1993  glass branches: 1.1.1;
added dd(1) from ftp.uu.net:bsd-sources; torching GNU dd
 1.1.1.1 22-Sep-1994  mycroft Import original 4.4-Lite version.
 1.9.8.1 26-Aug-2000  matt Pull up dd.c 1.17, extern.h 1.10, position 1.9. approved by thorpej:
>fix conv=swap when ibs!=obs
>block SIGINFO when writing
 1.20.2.1 10-Nov-2011  yamt sync with head
 1.22.20.1 26-Mar-2015  martin Pull up following revision(s) (requested by manu in ticket #640):
bin/dd/extern.h: revision 1.23
bin/dd/dd.1: revision 1.26
bin/dd/dd.1: revision 1.27
bin/dd/dd.h: revision 1.16
bin/dd/dd.c: revision 1.50
bin/dd/Makefile: revision 1.18
bin/dd/args.c: revision 1.39
Add iflag and oflag operands to dd(1)

Like GNU dd(1) similar operands, iflag and oflag allow specifying the
O_* flags given to open(2) for the input and the output file. The values
are comma-sepratated, lower-case, O_ prefix-stripped constants documented
in open(2).

Since iflag and oflag override default values, specifying oflag means
O_CREATE is not set by default and must be specified explicitely.
Some values do not make sense (e.g.: iflag=directory) but are still used
and will raise a warning. For oflag, values rdonly, rdwr and wronly are
filtered out with a warning (dd(1) attempts open(2) with O_RDWR and
then O_WRONLY on failure).

Specifying oflag=trunc along with (seek, oseek or conv=notrunc) is
contradictory and will raise an error.

iflag and oflag are disabled if building with -DMALLPROG

New sentence, new line. Fix typos. Bump date for previous.
 1.23.16.3 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.23.16.2 21-Apr-2020  martin Sync with HEAD
 1.23.16.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.26 09-Oct-2021  rillig dd: clean up function summary

No functional change. Ideally the binary would have stayed the same, but
GCC 10.3.0 inserts a nop and reorders the code.
 1.25 09-Oct-2021  rillig dd: fix lint error about 'return expr' from void function

No change to the resulting binary. The 'return' statements are necessary
for GCC to generate the exact same object code, even though they can be
removed without affecting the functionality, as seen before the 'else'.
 1.24 10-Sep-2021  rillig bin: remove unnecessary lint comment CONSTCOND

Since 2021-01-31, lint no longer warns about 'do ... while (0)'.

No functional change.
 1.23 07-Nov-2011  jym branches: 1.23.42;
As suggested by Enami, rework the msgfmt logic a bit:
- error out when an unknown specifier is used. Do this in f_msgfmt(),
before dd(1) starts operation.
- allow buffer_write() to flush the internal buffer even when NULL is
passed as parameter.

Some whitespace fixes too.
 1.22 06-Nov-2011  jym Add a new command to dd(1): msgfmt. The command modifies the
output of the information summary returned by dd(1). This can be used
to specify messages in a more usable (or parseable) format like
human-readable values.

My intent is to re-use this for building image files and quick I/O
benchmarking.

Reviewed by tsutsui@ on tech-userlevel. See also
http://mail-index.netbsd.org/tech-userlevel/2010/12/03/msg004179.html

Some examples:

$ dd if=/dev/zero of=/dev/null bs=1m count=1 msgfmt=human
1+0 records in
1+0 records out
1048576 bytes (1,0 MB) transferred in 0.001 secs (1048576000 bytes/sec - 1,0 GB/sec)

$ dd if=/dev/zero of=/dev/null count=1 msgfmt='
> <speed>%E</speed>
> <time>%s</time>
> <bytes>%b</bytes>
> '
<speed>500 KB/sec</speed>
<time>0.001</time>
<bytes>512</bytes>
 1.21 05-Oct-2007  lukem branches: 1.21.28;
Convert to using raise_default_signal(3).
 1.20 03-Jul-2007  lukem branches: 1.20.4;
In the SIGINT handler, explicitly display a summary and then raise the
default SIGINT handler to exit, rather than exit(0) and relying upon the
atexit() to display the summary.
Per SUS6.
 1.19 17-Jan-2004  dbj add support for conv=sparse
inspired by freebsd, although this patch attempts
to avoid some potential bugs in their implementation.
 1.18 04-Jan-2004  jschauma remove unused code left from printescaped() backput as pointed out by Jeff
Ito in PR bin/23969 and PR bin/23970.
 1.17 14-Sep-2003  jschauma Following private discussion with kleink@ and hubertf@ and public discussion
on tech-userlevel@, back out printescaped() functionality.
kleink: ``We sell rope.''
 1.16 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.
 1.15 04-Aug-2003  jschauma As discusses a little while back on tech-userlevel:

If stdout is a tty, use vis(3) to print any filenames to prevent garbage
from being printed if the filename contains control- or other non-printable
characters.

While here, sprinkle some EXIT_FAILURE and NOTREACHED where appropriate.
 1.14 26-Nov-2001  enami a bit more cosmetic changes.
 1.13 25-Nov-2001  lukem - Use u_longlong_t instead of u_quad_t, u_long, or int for various buffer sizes
- Add strsuftoull(), which parses a number into a u_longlong_t, with
multiplication support, and support for 'g' (GB) and 't' (TB) suffices.
If an error occurs, print to stderr and exit.
Based on get_blk() from args.c and strsufto*() (in other programs)
- Add strsuftoullx(), which acts as per strsuftoull() but returns the
error in the supplied buffer instead (if the returned buffer != "", an
error occurred)
- Replace get_bsz() use with strsuftoull()
- Remove (now) unnecessary argument validation
- Remove unused {f,p,s,t}_stats fields in struct IO
 1.12 25-Nov-2001  lukem - ANSI KNF
- WARNS=2 (mainly converting some "char *" -> "const char *")
 1.11 28-Apr-2001  ross In the words of Our Fearless Leader, I am "utterly sick" of dd(1)
lying to me about transfer rates. Do some fixed point frobbing to get
stuff like: 2486864 bytes transferred in 0.272 secs (9142882 bytes/sec)
 1.10 04-Jan-2001  lukem use more standard %ll_ in favour of %q_
 1.9 29-Jul-1999  hubertf Add "progress=1" switch to show a sign of life by printing a '.' for
every block written to the output file.
 1.8 28-Jul-1998  mycroft Delint.
 1.7 06-Feb-1998  thorpej quads must be cast to long long for printing.
 1.6 04-Feb-1998  enami Use u_quad_t instead of u_long to define struct STAT.bytes, which
is used to count bytes transfered, so that it won't overflow even if
transfer is more than 4Gbytes.
 1.5 20-Jul-1997  christos Fix compiler warnings.
Add WARNS=1
 1.4 21-Mar-1995  cgd convert to new RCS id conventions.
 1.3 22-Sep-1994  mycroft Merge 4.4-Lite version.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 04-May-1993  glass branches: 1.1.1;
added dd(1) from ftp.uu.net:bsd-sources; torching GNU dd
 1.1.1.1 22-Sep-1994  mycroft Import original 4.4-Lite version.
 1.20.4.1 06-Nov-2007  matt sync with HEAD
 1.21.28.1 10-Nov-2011  yamt sync with head
 1.23.42.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.23.42.1 21-Apr-2020  martin Sync with HEAD
 1.18 22-Nov-2010  pooka branches: 1.18.48;
Add two new operands: "rif" and "rof". They operate exactly like
"if" and "of" with the exception that the communicate with a rump
kernel instead of the host kernel.

For example, to write stdout to /tmp/file.txt in a rump kernel namespace:
dd rof=/tmp/file.txt

copy /file1 to /file2 inside a rump kernel:
dd rif=/file1 rof=/file2

copy a snippet from /dev/rmd0d on the rump kernel to the host fs:
dd rif=/dev/rmd0d of=save seek=1000 count=3

Eat that, usermode OS.

(I'll document the operands one I have some manpage to refer to
for rump client use).
 1.17 14-Feb-2009  lukem fix -Wsign-compare issues
 1.16 14-Sep-2003  jschauma branches: 1.16.40;
Following private discussion with kleink@ and hubertf@ and public discussion
on tech-userlevel@, back out printescaped() functionality.
kleink: ``We sell rope.''
 1.15 20-Aug-2003  kleink Minor KNF nit from rev. 1.13.
 1.14 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.
 1.13 04-Aug-2003  jschauma As discusses a little while back on tech-userlevel:

If stdout is a tty, use vis(3) to print any filenames to prevent garbage
from being printed if the filename contains control- or other non-printable
characters.

While here, sprinkle some EXIT_FAILURE and NOTREACHED where appropriate.
 1.12 26-Nov-2001  enami a bit more cosmetic changes.
 1.11 25-Nov-2001  lukem - ANSI KNF
- WARNS=2 (mainly converting some "char *" -> "const char *")
 1.10 28-Apr-2001  ross In the words of Our Fearless Leader, I am "utterly sick" of dd(1)
lying to me about transfer rates. Do some fixed point frobbing to get
stuff like: 2486864 bytes transferred in 0.272 secs (9142882 bytes/sec)
 1.9 02-Aug-2000  christos block siginfo during writes.
 1.8 09-Oct-1999  jtk branches: 1.8.6;
fix comment regarding when we attempt to seek
 1.7 04-Oct-1999  mycroft Use lseek(2) on character devices, damn it.
 1.6 25-Jul-1997  phil branches: 1.6.4; 1.6.6;
Do multiply in lseek calls as off_t arithmetic. This allows for seeks
of more than INT_MAX. Removed Check for INT_MAX as maximum seeks.
Fixes PR 2101.
 1.5 20-Jul-1997  christos Fix compiler warnings.
Add WARNS=1
 1.4 21-Mar-1995  cgd convert to new RCS id conventions.
 1.3 22-Sep-1994  mycroft Merge 4.4-Lite version.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 04-May-1993  glass branches: 1.1.1;
added dd(1) from ftp.uu.net:bsd-sources; torching GNU dd
 1.1.1.1 22-Sep-1994  mycroft Import original 4.4-Lite version.
 1.6.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.4.1 30-Apr-2000  he Pull up revisions 1.7-1.8 (requested by jhawk):
Correctly lseek() on non-tape character devices (e.g. disks)
as the manual page documents.
 1.8.6.1 26-Aug-2000  matt Pull up dd.c 1.17, extern.h 1.10, position 1.9. approved by thorpej:
>fix conv=swap when ibs!=obs
>block SIGINFO when writing
 1.16.40.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.18.48.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.18.48.1 21-Apr-2020  martin Sync with HEAD
 1.9 29-Nov-2002  lukem convert to using strsuftoll(3) from libc
 1.8 09-Jun-2002  matt Add LL to 1099511627776 since it won't fit in a long on ILP32 systems.
 1.7 31-Jan-2002  tv branches: 1.7.2;
Roll in fixes to permit cross-compiling from non-NetBSD hosts. This
round has been tested on Solaris/x86 and Linux hosts.

* Add host tools cap_mkdb, ctags, m4, uudecode.
* Protect __RCSID() and __COPYRIGHT() better.
* Reduce the number of places that need to include "config.h", to keep
sources closer to their "vanilla" versions.
* Add more compat #defines and autoconf-checked functions.
 1.6 29-Jan-2002  tv Blah, oversight. Revert previous; clean up to proper syntax, and add
conditional for <err.h>.
 1.5 29-Jan-2002  tv This doesn't appear to be used in src/tools any longer; remove the config.h
glue bits.
 1.4 22-Jan-2002  is add config.h when compiled as host tool.
 1.3 30-Nov-2001  thorpej Deal with LP64 printf format issues.
 1.2 26-Nov-2001  lukem Replace {u_,}longlong_t usage with {u,}int64_t, as the former has
"issues" and really shouldn't be used outside of the Sun XDR stuff.
Thanks again to Chuck Silvers for reminding me.
 1.1 25-Nov-2001  lukem - Use u_longlong_t instead of u_quad_t, u_long, or int for various buffer sizes
- Add strsuftoull(), which parses a number into a u_longlong_t, with
multiplication support, and support for 'g' (GB) and 't' (TB) suffices.
If an error occurs, print to stderr and exit.
Based on get_blk() from args.c and strsufto*() (in other programs)
- Add strsuftoullx(), which acts as per strsuftoull() but returns the
error in the supplied buffer instead (if the returned buffer != "", an
error occurred)
- Replace get_bsz() use with strsuftoull()
- Remove (now) unnecessary argument validation
- Remove unused {f,p,s,t}_stats fields in struct IO
 1.7.2.1 23-Jul-2004  tron Apply patch (requested by dbj in ticket 1724):
Fix problems when building the netbsd-1-6 branch with GCC 3.3.3.
 1.3 29-Nov-2002  lukem convert to using strsuftoll(3) from libc
 1.2 26-Nov-2001  lukem Replace {u_,}longlong_t usage with {u,}int64_t, as the former has
"issues" and really shouldn't be used outside of the Sun XDR stuff.
Thanks again to Chuck Silvers for reminding me.
 1.1 25-Nov-2001  lukem - Use u_longlong_t instead of u_quad_t, u_long, or int for various buffer sizes
- Add strsuftoull(), which parses a number into a u_longlong_t, with
multiplication support, and support for 'g' (GB) and 't' (TB) suffices.
If an error occurs, print to stderr and exit.
Based on get_blk() from args.c and strsufto*() (in other programs)
- Add strsuftoullx(), which acts as per strsuftoull() but returns the
error in the supplied buffer instead (if the returned buffer != "", an
error occurred)
- Replace get_bsz() use with strsuftoull()
- Remove (now) unnecessary argument validation
- Remove unused {f,p,s,t}_stats fields in struct IO

RSS XML Feed