Commit Graph

189 Commits

Author SHA1 Message Date
ru
7cba80f9da Bump document date for the latest functional change.
Minor markup tweaks.
2004-05-16 21:34:15 +00:00
njl
d7b4a9c5ca Style fixes and add gen to CLEANFILES.
Submitted by:	bde
2004-04-09 07:13:27 +00:00
markm
4383f14801 Remove clause 3 from the UCB licenses.
OK'ed by:	imp, core
2004-04-06 20:06:54 +00:00
ache
d33e9b93a7 Remove a.out at the end of 'make test' 2004-03-08 18:09:33 +00:00
bde
ac2e10a4f5 Fixed some style bugs (mainly unsorting and tab lossage in previous commit). 2004-03-06 08:21:32 +00:00
ache
ebdf8c08b8 Add a.out to CLEANFILES 2004-03-06 06:54:58 +00:00
ache
432e315dd7 Change locale name from non-existent ASCII to en_US.US-ASCII 2004-03-06 06:10:16 +00:00
phk
d0818243a9 Teach dd(1) about parity bits. 2004-03-05 19:35:51 +00:00
phk
99a4684d72 Add a test-target and reference vectors for the character converions. 2004-03-05 19:30:13 +00:00
markm
aafc494847 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
obrien
eaf3fff90a Quiet warnings about copyright[]. 2003-05-01 16:58:57 +00:00
ru
e6fb7d9461 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
ru
6999b65340 Fixed (soon might be fatal) -Wformat warnings. 2003-03-15 07:56:59 +00:00
markm
5736aa9039 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
phk
eed7833b83 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
ru
10c48e457c 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
obrien
c84c569bd1 Consistently use __FBSDID 2002-06-30 05:13:54 +00:00
keramida
b309515be2 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
ru
c17d65090d mdoc(7) police: replace the XXX with the correct width. 2002-05-29 14:01:27 +00:00
jedgar
47acb76e7c Add semicolon to empty default case to silence warning. 2002-05-11 03:12:02 +00:00
keramida
9e46855391 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
markm
43cc55dd2f 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
markm
7b7558d884 Fix warnings inspired by lint, a commercial lint and WARNS=4. 2002-02-22 20:51:00 +00:00
green
b3206d8278 Correct a logic bug that snuck in and broke multiplication of off_ts. 2002-02-07 02:54:30 +00:00
kris
bb3058824a Lock down with WFORMAT=1 except those directories with unfixed warnings.
Tested on i386 and alpha.
2002-02-04 02:49:19 +00:00
imp
5203a0a465 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
green
db659d013d 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
obrien
099f8ecbe9 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
ru
bde8ec1b70 mdoc(7) police: utilize the new .Ex macro. 2001-08-15 09:09:47 +00:00
ru
24c7b0a61d mdoc(7) police: s/BSD/.Bx/ where appropriate. 2001-08-14 10:01:54 +00:00
green
a9b531b74d Use __unused for non-used variables.
Submitted by:	Mike Barcroft <mike@q9media.com>
2001-06-29 20:06:47 +00:00
dd
3dc2f99bef 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
dd
7438ee8a47 Don't call exit(3) from a signal handler.
Obtained from:	OpenBSD
2001-06-24 01:55:17 +00:00
des
8e8983228c Add more headers that are required with -fno-builtin (stdlib and strings) 2001-06-19 15:41:57 +00:00
ru
be1f850a8f mdoc(7) police: use the new features of the Nm macro. 2000-11-20 11:39:41 +00:00
green
aa2e16431f 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
wollman
c5c43ce91f Don't depend on <sys/stat.h> bogusly including <sys/time.h> (and thereby
<time.h>).
2000-10-10 01:50:26 +00:00
green
1ab6aa1440 Make the comment regarding ftruncate() correct. 2000-07-20 19:21:40 +00:00
green
5f788961ba 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
obrien
f84c12deda 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
green
bcb4b1ee2b 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
green
198256e173 Fix style bugs I introduced in the last revision.
Brucified by:	bde
2000-02-27 16:40:39 +00:00
green
708c7f49eb 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
gsutter
b5faf349c6 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
green
9ad0971067 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
green
277eda1860 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
green
0a7a70c712 Nuke the FIODTYPE compatibility bits. It's time. 1999-10-03 18:49:51 +00:00
green
a12ece1af8 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
green
4e25c183b5 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
green
996b2b913e 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
green
e40ba94136 ISDISK -> ISSEEK
Allow a device type of D_DISK or D_MEM to be ISSEEK.
1999-09-12 18:56:12 +00:00
green
4c16a85a3f 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
green
a9f7b5ee69 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
green
c4aced0891 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
66312e4a8d $Id$ -> $FreeBSD$ 1999-08-27 23:15:48 +00:00
green
1b913741fc Use FIODTYPE to unbogosify much of the file type checking in dd. 1999-08-27 16:36:46 +00:00
green
ac63841b82 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
green
788bc0cf60 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
green
90290405cf 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
713dd62834 Various spelling/formatting changes.
Submitted by: Philippe Charnier <charnier@xp11.frmug.org>
1999-05-08 10:22:15 +00:00
imp
321c551969 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
bde
670450a851 Fixed printf format errors. 1998-12-07 12:37:11 +00:00
bde
bddae886ca Describe `bs=n' more precisely. Fixed some English errors.
Obtained from:		OpenBSD
1998-11-29 13:54:20 +00:00
charnier
e3ba26c492 Restore Lite-2 sccsid. Restore include of sys/types.h. 1998-05-13 07:33:54 +00:00
charnier
c4d26d7f83 Correct use of .Nm and other cosmetics. Add rcsid. Remove unused #inc. 1998-05-06 06:51:42 +00:00
bde
b54fa2acf7 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
asami
961b4eea9b Fix printing for bytes read > 4G.
Reviewed by:	bde
1998-02-11 02:23:31 +00:00
joerg
4c50cd5b5a 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
f4281a32a5 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
502b1fbc97 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
9f4a5b3950 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
4841b45bbe 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
34721f2246 Add <sys/errno.h> 1997-10-09 10:50:54 +00:00
eivind
a63bff464b 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
8e86c4888a 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
jlemon
276d42acd0 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
bde
68962748a6 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
fadc8fc0f2 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
83b3c2c161 Revert $FreeBSD$ to $Id$ 1997-02-22 14:13:04 +00:00
jkh
808a36ef65 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
c5d0f9cb39 -Wall cleaning. 1996-12-14 06:08:03 +00:00
phk
6c0fd53b32 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
phk
74bda8433b Increase precision of duration to milliseconds.
Some heuristics to avoid overflow in calculation attempted.
1996-11-12 23:09:15 +00:00
ache
b2faa00f39 Add setlocale LC_CTYPE 1995-10-23 21:31:48 +00:00
ache
5887fd95f0 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
ache
eb022aca1e Make conv=[lu]case works with localized ctype (8bit) 1995-01-17 22:55:59 +00:00
dg
8722740e7f Added $Id$ 1994-09-24 02:59:15 +00:00
phk
1da6fa08f8 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
rgrimes
e3cfc8ce61 BSD 4.4 Lite bin Sources 1994-05-26 06:18:55 +00:00