Commit Graph

188 Commits

Author SHA1 Message Date
Nate Lawson
3066c4a4bd Style fixes and add gen to CLEANFILES.
Submitted by:	bde
2004-04-09 07:13:27 +00:00
Mark Murray
6195fb4102 Remove clause 3 from the UCB licenses.
OK'ed by:	imp, core
2004-04-06 20:06:54 +00:00
Andrey A. Chernov
c65eeb736e Remove a.out at the end of 'make test' 2004-03-08 18:09:33 +00:00
Bruce Evans
d493ed0f97 Fixed some style bugs (mainly unsorting and tab lossage in previous commit). 2004-03-06 08:21:32 +00:00
Andrey A. Chernov
c6f22660ff Add a.out to CLEANFILES 2004-03-06 06:54:58 +00:00
Andrey A. Chernov
adde319c62 Change locale name from non-existent ASCII to en_US.US-ASCII 2004-03-06 06:10:16 +00:00
Poul-Henning Kamp
6a3d33ac5e Teach dd(1) about parity bits. 2004-03-05 19:35:51 +00:00
Poul-Henning Kamp
3d36fd4271 Add a test-target and reference vectors for the character converions. 2004-03-05 19:30:13 +00:00
Mark Murray
eac4bdcca4 Get this area compiling with the highest WARNS= that it works with.
Obsolete WFORMAT= junk also removed where possible.

OK'ed by:	obrien
Tested on:	sparc64, alpha, i386
2003-06-13 07:04:02 +00:00
David E. O'Brien
09a80d4867 Quiet warnings about copyright[]. 2003-05-01 16:58:57 +00:00
Ruslan Ermilov
bfd86a6070 ssize_t is not required to be the same width as size_t by the
specs, so cast to intmax_t where appropriate.

Pointed out by:	bde
2003-03-15 13:34:48 +00:00
Ruslan Ermilov
024ae00499 Fixed (soon might be fatal) -Wformat warnings. 2003-03-15 07:56:59 +00:00
Mark Murray
7503d74f54 WARNS=4 fixes. This would be WARNS=9 if we were -std=99 instead of
-ansi, due to 'long long'.

Reviewed by:	green (slightly earlier version)
2003-02-27 18:04:54 +00:00
Poul-Henning Kamp
cd967e322a Don't call DIOCWLABEL on disks, it is not implemented, and calling it
like this negated any practical value of the feature.
2003-01-26 11:13:40 +00:00
Ruslan Ermilov
e27480d64d mdoc(7) police:
Revert to using the .Tn POSIX and .Tn ANSI instead of \*[Px] and \*[Ai]
strings; using these strings is unsafe in troff mode, as they include a
change in a font size.

Approved by:	re
2002-11-26 17:55:41 +00:00
David E. O'Brien
5eb43ac2f7 Consistently use __FBSDID 2002-06-30 05:13:54 +00:00
Giorgos Keramidas
a7c1ac2f62 Replace <strings.h> with <string.h>. No functions from the former are
used in this file, and strlen() needs to be prototyped by the latter,
for this to compile without warnings.

Reviewed by:	mike
2002-06-09 04:15:40 +00:00
Ruslan Ermilov
7b3e3e39c7 mdoc(7) police: replace the XXX with the correct width. 2002-05-29 14:01:27 +00:00
Chris D. Faulhaber
c01df1d365 Add semicolon to empty default case to silence warning. 2002-05-11 03:12:02 +00:00
Giorgos Keramidas
80c7362ce3 Various mdoc fixes, including a change that corrects spacing as
described in PR docs/36461.

PR:		docs/36461
Noticed by:	Gary W. Swearingen <swear@blarg.net>
Submitted by:	ru
2002-03-31 20:49:37 +00:00
Mark Murray
afa5289a98 1) Rev.1.35 of dd.c has a more serious regression. It backs out rev.1.31,
thus breaking systems with unpolluted <sys/stat.h>'s.

2) Back out an initialisation of a variable in BSS.

Reported by:	bde (1), many(2)
2002-03-07 14:00:33 +00:00
Mark Murray
9afa09cd0e Fix warnings inspired by lint, a commercial lint and WARNS=4. 2002-02-22 20:51:00 +00:00
Brian Feldman
2fb080722f Correct a logic bug that snuck in and broke multiplication of off_ts. 2002-02-07 02:54:30 +00:00
Kris Kennaway
afe781faa2 Lock down with WFORMAT=1 except those directories with unfixed warnings.
Tested on i386 and alpha.
2002-02-04 02:49:19 +00:00
Warner Losh
f9bcb0beb5 o __P has been reoved
o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int argc, char *argv[]) is the preferred main definition.
o Attempt to not break style(9) conformance for declarations more than
  they already are.

Approved by: arch@, new style(9)
2002-02-02 06:24:13 +00:00
Brian Feldman
4ed955372c Commit general cleanups (separate get_num() and get_off_t() functions to
debogosify some of the command-line string-number conversions into
an unsigned and signed variant.)
2002-01-25 17:44:47 +00:00
David E. O'Brien
a748290789 Default to WARNS=2. Binary builds that cannot handle this must explicitly
set WARNS=0.

Reviewed by:	mike
2001-12-04 01:57:47 +00:00
Ruslan Ermilov
d628d776c4 mdoc(7) police: utilize the new .Ex macro. 2001-08-15 09:09:47 +00:00
Ruslan Ermilov
753d686d34 mdoc(7) police: s/BSD/.Bx/ where appropriate. 2001-08-14 10:01:54 +00:00
Brian Feldman
9f3537caad Use __unused for non-used variables.
Submitted by:	Mike Barcroft <mike@q9media.com>
2001-06-29 20:06:47 +00:00
Dima Dorfman
7a507517de Previous commit broke dd(1)'s I/O summary when it's terminated by a
signal.  Fix it by adding an explicit call to summary() in terminate()
(it was previously called implicitly by exit() because summary() was
registered with atexit()).  summary() is supposed to be signal-safe--
it handles SIGINFO almost exclusively--so this should be safe.

Submitted by:	bde
2001-06-25 06:17:02 +00:00
Dima Dorfman
e0e97f0aab Don't call exit(3) from a signal handler.
Obtained from:	OpenBSD
2001-06-24 01:55:17 +00:00
Dag-Erling Smørgrav
26f6b0fbe8 Add more headers that are required with -fno-builtin (stdlib and strings) 2001-06-19 15:41:57 +00:00
Ruslan Ermilov
be8b149795 mdoc(7) police: use the new features of the Nm macro. 2000-11-20 11:39:41 +00:00
Brian Feldman
53885065b7 Allow negative seek offsets for files that can be seeked upon. It
makes dd(1) a more complete "filter", even if this functionality is
limited to seekable streams.
2000-10-22 23:00:32 +00:00
Garrett Wollman
eb2fc78027 Don't depend on <sys/stat.h> bogusly including <sys/time.h> (and thereby
<time.h>).
2000-10-10 01:50:26 +00:00
Brian Feldman
5976ee7e31 Make the comment regarding ftruncate() correct. 2000-07-20 19:21:40 +00:00
Brian Feldman
c15c898eff Various cleanups are made to reduce warnings and make code prettier :)
Also, check for ftruncate() return value and die on failure, but only
try to ftruncate() when the file is a regular file.
2000-07-01 05:36:25 +00:00
David E. O'Brien
015a53cfff Fix ``dd if=/dev/zero of=/dev/daN'' on the Alpha by allowing the label
to be overwritten.

Submitted by:	green
2000-05-24 06:47:10 +00:00
Brian Feldman
6be607d0d5 After Bruce kindly explained the whole groff "sentence" idea to me, I've
put the whitespace in the right place.
2000-03-01 05:28:45 +00:00
Brian Feldman
c107f9e04f Fix style bugs I introduced in the last revision.
Brucified by:	bde
2000-02-27 16:40:39 +00:00
Brian Feldman
a6d413e7f8 Add iseek= and oseek= aliases for the preexisting skip= and seek=
operands.  Can _YOU_ tell skip= and seek= apart with 100% accuracy
every time?

This also seems to make us option-for-option compatible with the
Solaris dd(1).

Approved by:	jkh
Suggested by:	peter
2000-02-26 21:29:44 +00:00
Gregory Sutter
276d5ee851 Reflect that dd accepts octal and hexadecimal numbers (in addition to decimal).
PR:		16750
Submitted by:	Giorgos Keramidas <keramida@ceid.upatras.gr>
2000-02-18 04:55:40 +00:00
Brian Feldman
dd92370286 I've been Brucified! I did evil things with typedefs, but I'll do it
the correct (but less aesthetic) way, now.  New lesson: correctness
and aestheticity may be mutually exclusive at times.

Brucified by:	bde
1999-12-08 02:44:46 +00:00
Brian Feldman
67f80d12af Do proper constification in args.c. This shuts up -Wcast-qual (thanks,
bfumerola for that pointer!) in GCC complaining about losing a const.

While I'm here, might as well mark in the Makefile that I'm the
${MAINTAINER}.  It seems like that's what everyone's doing these days.
1999-12-07 03:32:37 +00:00
Brian Feldman
bf3367d091 Nuke the FIODTYPE compatibility bits. It's time. 1999-10-03 18:49:51 +00:00
Brian Feldman
5ff6541e7a Make count=0 set cpy_cnt to -1, which is slight overloading, but makes
what I was trying to do work much better (ie at all.  I could have sworn
it was working...) Fix a SEEK_SET to be SEEK_CUR, and make Bruce's
lseek() test work correctly.
1999-09-16 19:50:59 +00:00
Brian Feldman
1838cf5671 Let count=-something fail, while count=0 may succeed, thus making dd(1)
useful as a seeking-tool as well as its many other uses.  Previously,
dd(1) would succeed with count=0, but wouldn't get to the point that
blocks were to be read/written. This is a more useful behavior, and
this specific case doesn't seem to be handled by POSIX.
1999-09-16 05:12:59 +00:00
Brian Feldman
7599187e0d Even more dd(1) cleanups! Thanks to Bruce for staying on my case until
we're done (not yet!) :)
1999-09-13 21:47:10 +00:00
Brian Feldman
32952d4b37 ISDISK -> ISSEEK
Allow a device type of D_DISK or D_MEM to be ISSEEK.
1999-09-12 18:56:12 +00:00
Brian Feldman
5868747254 Even more cleanups to dd(1). This is probably the culmination of the
BDEification process of dd(1). Most of the changes are from BDE's archive.
Support for negative offsets is gone again, but the case where you
lseek() onto byte -1 of something from a negative offset using seek/skip
is fixed; if you end up on -1, you won't get a false positive lseek failure.
  The biggest changes are to data types (more size_t, for instance) and
argument parsing. skip/seek on /dev/{,k}mem now occurs (instead of "read
until you reach the offset") due to mem devices now being D_DISK. Some
const things are now correctly declared as such, and the "case table"
building is better. The only thing that seems to be left to make dd(1)
everything TOG wants it to be is l10n.
1999-09-12 16:51:53 +00:00
Brian Feldman
e14f7e789a Make a bit more headway with dd's argument parsing, etc. get_bsz() is
renamed get_num() since it's not just about block sizes. skip and
seek can be any offset, including negative, now. Some style bogons are fixed.
1999-09-11 00:02:42 +00:00
Brian Feldman
ff8bb989ab Relax things a bit. Not having FIODTYPE will be a warning for now.
Pointy hat:	green
Pointed out by:	peter
1999-08-28 03:37:38 +00:00
Peter Wemm
2a4562393f $Id$ -> $FreeBSD$ 1999-08-27 23:15:48 +00:00
Brian Feldman
e08d7384ee Use FIODTYPE to unbogosify much of the file type checking in dd. 1999-08-27 16:36:46 +00:00
Brian Feldman
769e5815e3 Implement seekability for disk devices (not just regular files).
Also, fix pos_out() to do the same checks pos_in() did.

Done for:	jdp, luigi, the good of the world
1999-07-13 18:44:56 +00:00
Brian Feldman
54946e00b2 This is the second round of dd(1) changes. Some changes made/reversed by
request of Bruce. More changes may follow later. 'g' multiplier has
been added (i.e. dd seek=5g if=bigfile.) Some minor corrections were made
as well.

Noticed by: bde
1999-06-20 14:58:55 +00:00
Brian Feldman
767bc8ad79 Miscellaneous dd(1) changes: mainly fixing variable types (size_t, ssize_t,
off_t, int, u_int64_t, etc.). dd(1) should now work properly with REALLY
big amounts of data.
1999-06-19 19:49:35 +00:00
Kris Kennaway
46be34b902 Various spelling/formatting changes.
Submitted by: Philippe Charnier <charnier@xp11.frmug.org>
1999-05-08 10:22:15 +00:00
Warner Losh
426e9c1dcc First set of fixes to keep egcs happy. These include {} around single
statement if blocks[*] when the else could be ambiguous, not defaulting
to int type and removal of some unused variables.

[*] This is explicitly allowed by style(9) when the single statement
spans more than one line.

Reviewed by: obrien, chuckr
1999-04-25 21:13:34 +00:00
Bruce Evans
f58a6c7a68 Fixed printf format errors. 1998-12-07 12:37:11 +00:00
Bruce Evans
7d159f8837 Describe `bs=n' more precisely. Fixed some English errors.
Obtained from:		OpenBSD
1998-11-29 13:54:20 +00:00
Philippe Charnier
1ba0e048a2 Restore Lite-2 sccsid. Restore include of sys/types.h. 1998-05-13 07:33:54 +00:00
Philippe Charnier
cbf6f7d358 Correct use of .Nm and other cosmetics. Add rcsid. Remove unused #inc. 1998-05-06 06:51:42 +00:00
Bruce Evans
7eaa685e41 Exit with a nonzero status if we get killed by a SIGINT. POSIX.2
specifies exiting with a zero status if the file was copied
successfully, and with a nonzero status if an error occurred.  We
are too sloppy to tell if the file was copied successfully when we
get killed by a SIGINT, but it is unlikely to have been.  Added a
comment about related sloppiness (calling exit() from a signal
handler).
1998-02-24 01:45:05 +00:00
Satoshi Asami
2f719e7069 Fix printing for bytes read > 4G.
Reviewed by:	bde
1998-02-11 02:23:31 +00:00
Joerg Wunsch
1f68c20551 Oops, back out rev 1.5, it wasn't my intention to also commit the
-g. ;)
1998-01-07 22:32:28 +00:00
Joerg Wunsch
a28ea077f9 Use the correct value in the call to swab(3) with conv=swab. Previously,
dd if=/dev/zero of=/dev=null obs=23520 conv=swab
coredumped.

Please somebody review it, i'm not 105 % sure i'm understanding all
this mess correctly.

Detected by:	Holm Tiffe <holm@geophysik.tu-freiberg.de>
1998-01-07 22:31:19 +00:00
Eivind Eklund
1ee36a5be6 It's more portable to use <errno.h> than <sys/errno.h>
Pointed-out-by:	bde (a long while ago)
1997-12-15 20:37:43 +00:00
Joerg Wunsch
1898febe2d Sort "sparse" into alphabetical order, since dd's `conv' options need
to be sorted.  This temporarily broke the "osync" option.
1997-11-11 20:35:29 +00:00
Joerg Wunsch
4ddfeabd8f Teach dd(1) about an option to write sparse files. Can be useful for
things like diskless clients' swap files etc.

Submitted by:	pascal@zuo.dec.com (Pascal Pederiva) (ages ago, with many
						  stylistic changes by me)
1997-10-11 20:09:05 +00:00
Eivind Eklund
73db7d72c8 Add <sys/errno.h> 1997-10-09 10:50:54 +00:00
Eivind Eklund
bd6b64117b make signal handlers errno safe
Obtained from:	OpenBSD (file rev 1.5) Theo de Raadt <deraadt@openbsd.org>
1997-10-08 12:59:14 +00:00
Eivind Eklund
4c33974251 Slightly improved fix compared to my insiration
don't munge argv strings -- copy them first. avoids 'w' showing:
    deraadt  p8 zeus.theos.com    8:26AM     3 dd if of bs

Obtained from:	OpenBSD (file rev 1.3) by Theo de Raadt <deraadt@openbsd.org>
1997-10-08 12:10:33 +00:00
Jonathan Lemon
af041bf3fd Pad the input buffer whenever sync is used, not just if the noerror flag
is also set.
Change osync to not to tack on an empty block if the input buffer is null,
    or an even multiple of the blocksize.
Also change osync to pad the output with nulls/spaces depending whether
   this is a block-oriented conversion or not (same as sync).

PR:		3818
1997-08-19 19:46:18 +00:00
Bruce Evans
3e75bb9be1 Fixed overflow for attempts to seek to offsets > ULONG_MAX. See the
OpenBSD version for more complete fixes.  E.g., to seek to offsets >
INT_MAX using a block size of 1, block numbers need to be off_t's
instead of u_long's.
1997-04-30 17:51:29 +00:00
Steve Price
939a4c24e5 Change spelling of ECBDIC to EBCDIC. Closes PR #3402
Submitted by:	h-nokubi@nmit.mt.nec.co.jp
1997-04-28 04:07:29 +00:00
Peter Wemm
b97fa2ef50 Revert $FreeBSD$ to $Id$ 1997-02-22 14:13:04 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Steve Price
78b09ffeaf -Wall cleaning. 1996-12-14 06:08:03 +00:00
Poul-Henning Kamp
ad66f7ee71 Bruce says: "You have been programming in the kernel for too long :-)."
and he's right ... I forgot about this floating point stuff you can
use in user-land :-)

Increase precision of duration to microseconds.
No heuristics to avoid overflow in calculation needed - just depend
on DBL_MAX being a bit larger than LONG_MAX.

Use double instead of `struct timeval' in dd.h so that everything
doesn't have to include <sys/time.h>.

Fixed style bugs in recent and old FreeBSD changes.

Reviewed by:	phk
Submitted by:	bde
1996-11-13 20:00:03 +00:00
Poul-Henning Kamp
77dfeccef6 Increase precision of duration to milliseconds.
Some heuristics to avoid overflow in calculation attempted.
1996-11-12 23:09:15 +00:00
Andrey A. Chernov
f7c627b282 Add setlocale LC_CTYPE 1995-10-23 21:31:48 +00:00
Andrey A. Chernov
c5191e580d More koshering [ul]case fix, don't use pre-initialized tables at all,
treat 0xFF as valid character.
1995-01-17 23:04:29 +00:00
Andrey A. Chernov
dde07463cf Make conv=[lu]case works with localized ctype (8bit) 1995-01-17 22:55:59 +00:00
David Greenman
89730b290a Added $Id$ 1994-09-24 02:59:15 +00:00
Poul-Henning Kamp
d4daf998ed Applied patch to make -Wall and -Dlint shut up.
Reviewed by:	phk
Submitted by:	Josef Grosch <joeg@gagme.wwa.com>
1994-09-20 06:24:56 +00:00
Rodney W. Grimes
4b88c807ea BSD 4.4 Lite bin Sources 1994-05-26 06:18:55 +00:00