Commit Graph

110 Commits

Author SHA1 Message Date
christos 37a296c0b9 PR/48057: psi: skip and msgfmt cannot be used together. Looks like a pasto;
fixed.
2013-07-17 12:55:48 +00:00
christos aa24bb3ca4 let the standard rules deal with librumpclient 2012-08-08 14:09:14 +00:00
wiz 5ac3b50142 - sync `SYNOPSIS' with dd.c's `usage' line;
- correct spelling (prepositions).

From Bug Hunting.
2012-06-20 17:54:16 +00:00
matt 3ee36a48b5 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.
2012-02-21 01:49:01 +00:00
jym 331bd1b067 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.
2011-11-07 22:24:23 +00:00
jym 234ccf064a 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>
2011-11-06 21:22:23 +00:00
joerg 6b5273200c Use __dead for the small build too 2011-09-16 16:06:23 +00:00
joerg 5bb1ddccc2 Use __dead 2011-08-29 14:51:17 +00:00
pooka 37c4e1235f 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!)
2011-02-04 19:42:12 +00:00
jym d4045078ec No need to cast with bsearch(), it returns a void *. Use __arraycount(). 2011-01-13 23:45:13 +00:00
riz d766fd33f5 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.
2010-12-23 21:55:40 +00:00
enami a46391d703 Add iseek and oseek option as aliases for skip and seek respectively.
These options exist in dd of solaris or svr3.  From FreeBSD.
2010-12-22 09:42:53 +00:00
enami db65e26847 Copy argument before modifying it so that ps shows entire argument.
From OpenBSD via FreeBSD.
2010-12-22 09:39:06 +00:00
pooka e5d7b7bef0 remove some leftover development garbage 2010-12-14 19:04:05 +00:00
pooka 49242e416d Make compile on non-NetBSD. 2010-12-14 19:03:21 +00:00
enami 8701b1fd0e Wrap long line. 2010-12-09 10:24:56 +00:00
pooka 39a175ce63 Fix most inopportune typo. from gson & jmmv. 2010-12-06 15:23:29 +00:00
jym 44e64860fc Hmm, for 'rof', I believe that C_ROF|C_OF is invalid rather than
C_ROF|C_ROF.

Hi pooka :)
2010-12-05 23:35:59 +00:00
pooka 7192ed629b extra crunchgen hoops 2010-11-22 21:59:09 +00:00
pooka 6b03da8b7e 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).
2010-11-22 21:04:27 +00:00
joerg 0739fbbbf2 Don't workaround macro argument limit in ancient troff. 2009-03-11 12:43:58 +00:00
lukem 9050ab5cfa fix -Wsign-compare issues 2009-02-14 07:12:29 +00:00
lukem 2fe2731d3f Remove the \n and tabs from the __COPYRIGHT() strings. 2008-07-20 00:52:39 +00:00
christos 9655f5c24c PR/38755: murray armfield: /bin posix programs missing setprogname and/or
setlocale
2008-05-26 14:21:08 +00:00
lukem db822d2217 Convert to using raise_default_signal(3). 2007-10-05 07:22:23 +00:00
lukem 4cac80e3e4 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.
2007-07-03 05:25:25 +00:00
msaitoh 8ce1f4fff2 fix typos 2007-04-29 20:23:34 +00:00
lukem 3851cea520 Use IEC 60027-2 prefixes for 2^n based prefixes. 2007-04-13 00:38:45 +00:00
wiz 01db637894 Bump date for progress=n description change. 2006-01-12 21:42:11 +00:00
apb b7d86f5e4c 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
2006-01-09 10:17:05 +00:00
christos 6310b59691 sprinkle a little const, and now everything compiles with WARNS=3 2005-06-26 19:10:48 +00:00
rillig 57fc49ddbc Fixed an off-by-one error with ASCII <-> EBCDIC conversion combined with
lcase/ucase. Approved by mrg.
2005-04-20 17:38:59 +00:00
wiz e3fc4b66c3 Spell the plural of suffix "suffixes", not "suffices".
Inspired by PR 24400 by Todd Vierling.
2004-02-13 17:56:17 +00:00
dbj f01a4aa26e minor nit, set out.dbp correctly when constructing final null block
for sparse files.
2004-01-17 21:00:16 +00:00
dbj 6b4933739d add support for conv=sparse
inspired by freebsd, although this patch attempts
to avoid some potential bugs in their implementation.
2004-01-17 20:48:57 +00:00
dbj cae90fa713 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.
2004-01-17 05:42:50 +00:00
jschauma ad8530d1eb remove unused code left from printescaped() backput as pointed out by Jeff
Ito in PR bin/23969 and PR bin/23970.
2004-01-04 16:04:18 +00:00
dsainty 39973c5237 Optimise previous change, using fcntl(F_DUPFD) to locate a free descriptor
for us, rather than iterating until satisfied.

Suggested by David Laight.
2003-11-15 14:55:32 +00:00
dsainty 0b16f71074 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".
2003-11-15 12:44:54 +00:00
jschauma 6a75fbb636 Following private discussion with kleink@ and hubertf@ and public discussion
on tech-userlevel@, back out printescaped() functionality.
kleink: ``We sell rope.''
2003-09-14 19:20:16 +00:00
jschauma 39ff49f1b4 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.)
2003-08-20 14:25:54 +00:00
kleink 5d98794ef5 Minor KNF nit from rev. 1.13. 2003-08-20 10:43:55 +00:00
agc b5b2954259 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22249, verified by myself.
2003-08-07 09:05:01 +00:00
erh e5f16a4651 Include stdlib.h so EXIT_FAILURE is defined. 2003-08-05 14:55:03 +00:00
jschauma 458ed23412 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.
2003-08-04 22:31:21 +00:00
wiz 990562bfef .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
2003-02-25 10:34:36 +00:00
lukem 550a64a8e9 convert to using strsuftoll(3) from libc 2002-11-29 13:11:10 +00:00
enami caa54090d6 Add comment about my rev. 1.27 change. 2002-09-04 04:21:54 +00:00
tron 4fc0806163 Ignore EINVAL returned from fsync(2) because it is the expected error code
if we try to use it on a pipe.
2002-09-03 06:17:26 +00:00
enami cef250dab9 Detect the last nfs write error. 2002-09-01 11:33:22 +00:00