summaryrefslogtreecommitdiffstats
path: root/bin/dd/dd.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC rev. 265593:thomas2014-05-211-24/+43
| | | | | | | | | (dd_out): Fix handling of all-zeroes block at end of input with conv=sparse. PR: bin/189174 PR: bin/189284 Reviewed by: kib
* Make dd's signal handler async safe.eadler2013-05-101-1/+5
| | | | | | | | | PR: bin/75258 Submitted by: "Oleg V. Nauman" <oleg@reis.zp.ua> Arrival Date: Sun Dec 19 14:50:21 GMT 2004 Reviewed by: mjg, jhb Reviewed by: jilles (earlier version) MFC after: 1 week
* Literally follow POSIX:kib2013-04-231-1/+1
| | | | | | | | | | | | | If the bs= expr operand is specified and no conversions other than sync, noerror, or notrunc are requested, the data returned from each input block shall be written as a separate output block. In particular, when both bs=size and conv=sparce were specified, the resulted file was fully filled, instead of sparce. PR: standards/177742 Submitted by: Matthew Rezny <mrezny@hexaneinc.com> MFC after: 2 weeks
* IFP4 change 222074.brooks2013-04-031-0/+7
| | | | | | | | | | Introduce an explicit close of the output descriptor so that work done on close is accounted for in the summary output triggered at exit (implicit close()s occur after atexit() hooks). This is useful because some devices such as cfi(4) may perform signficant work after a close occurs (e.g. erasing and rewriting a block of flash).
* Rework all non-contributed files that use `struct timezone'.ed2012-09-011-2/+2
| | | | | | | | | | | | | | This structure is not part of POSIX. According to POSIX, gettimeofday() has the following prototype: int gettimeofday(struct timeval *restrict tp, void *restrict tzp); Also, POSIX states that gettimeofday() shall return 0 (as long as tzp is not used). Remove dead error handling code. Also use NULL for a nul-pointer instead of integer 0. While there, change all pieces of code that only use tv_sec to use time(3), as this provides less overhead.
* Add a "fillchar" command line argument to dd(1) that permits the userrwatson2004-08-151-2/+7
| | | | | | | to specify an alternative padding character when using a conversion mode, or when using noerror with sync and an input error occurs. This facilities reading old and error-prone media by allowing the user to more effectively mark error blocks in the output stream.
* Remove clause 3 from the UCB licenses.markm2004-04-061-4/+0
| | | | OK'ed by: imp, core
* Teach dd(1) about parity bits.phk2004-03-051-21/+54
|
* Quiet warnings about copyright[].obrien2003-05-011-2/+2
|
* WARNS=4 fixes. This would be WARNS=9 if we were -std=99 instead ofmarkm2003-02-271-4/+5
| | | | | | -ansi, due to 'long long'. Reviewed by: green (slightly earlier version)
* Don't call DIOCWLABEL on disks, it is not implemented, and calling itphk2003-01-261-7/+1
| | | | like this negated any practical value of the feature.
* Consistently use __FBSDIDobrien2002-06-301-2/+2
|
* 1) Rev.1.35 of dd.c has a more serious regression. It backs out rev.1.31,markm2002-03-071-1/+2
| | | | | | | | 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)
* Fix warnings inspired by lint, a commercial lint and WARNS=4.markm2002-02-221-3/+2
|
* o __P has been reovedimp2002-02-021-16/+11
| | | | | | | | | | | 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)
* Commit general cleanups (separate get_num() and get_off_t() functions togreen2002-01-251-1/+1
| | | | | debogosify some of the command-line string-number conversions into an unsigned and signed variant.)
* Use __unused for non-used variables.green2001-06-291-1/+1
| | | | Submitted by: Mike Barcroft <mike@q9media.com>
* Don't depend on <sys/stat.h> bogusly including <sys/time.h> (and therebywollman2000-10-101-0/+1
| | | | <time.h>).
* Make the comment regarding ftruncate() correct.green2000-07-201-2/+2
|
* Various cleanups are made to reduce warnings and make code prettier :)green2000-07-011-9/+14
| | | | | Also, check for ftruncate() return value and die on failure, but only try to ftruncate() when the file is a regular file.
* Fix ``dd if=/dev/zero of=/dev/daN'' on the Alpha by allowing the labelobrien2000-05-241-1/+8
| | | | | | to be overwritten. Submitted by: green
* Nuke the FIODTYPE compatibility bits. It's time.green1999-10-031-3/+1
|
* Make count=0 set cpy_cnt to -1, which is slight overloading, but makesgreen1999-09-161-4/+15
| | | | | | 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.
* Even more dd(1) cleanups! Thanks to Bruce for staying on my case untilgreen1999-09-131-14/+15
| | | | we're done (not yet!) :)
* ISDISK -> ISSEEKgreen1999-09-121-2/+2
| | | | Allow a device type of D_DISK or D_MEM to be ISSEEK.
* Even more cleanups to dd(1). This is probably the culmination of thegreen1999-09-121-37/+21
| | | | | | | | | | | | | 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.
* Relax things a bit. Not having FIODTYPE will be a warning for now.green1999-08-281-8/+12
| | | | | Pointy hat: green Pointed out by: peter
* $Id$ -> $FreeBSD$peter1999-08-271-1/+1
|
* Use FIODTYPE to unbogosify much of the file type checking in dd.green1999-08-271-10/+15
|
* Implement seekability for disk devices (not just regular files).green1999-07-131-1/+6
| | | | | | Also, fix pos_out() to do the same checks pos_in() did. Done for: jdp, luigi, the good of the world
* This is the second round of dd(1) changes. Some changes made/reversed bygreen1999-06-201-16/+14
| | | | | | | | 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
* Miscellaneous dd(1) changes: mainly fixing variable types (size_t, ssize_t,green1999-06-191-21/+25
| | | | | off_t, int, u_int64_t, etc.). dd(1) should now work properly with REALLY big amounts of data.
* First set of fixes to keep egcs happy. These include {} around singleimp1999-04-251-5/+6
| | | | | | | | | | 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
* Restore Lite-2 sccsid. Restore include of sys/types.h.charnier1998-05-131-2/+2
|
* Correct use of .Nm and other cosmetics. Add rcsid. Remove unused #inc.charnier1998-05-061-4/+4
|
* Use the correct value in the call to swab(3) with conv=swab. Previously,joerg1998-01-071-2/+2
| | | | | | | | | | 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>
* Teach dd(1) about an option to write sparse files. Can be useful forjoerg1997-10-111-4/+33
| | | | | | | things like diskless clients' swap files etc. Submitted by: pascal@zuo.dec.com (Pascal Pederiva) (ages ago, with many stylistic changes by me)
* Pad the input buffer whenever sync is used, not just if the noerror flagjlemon1997-08-191-10/+12
| | | | | | | | | | 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
* Revert $FreeBSD$ to $Id$peter1997-02-221-1/+1
|
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | 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.
* -Wall cleaning.steve1996-12-141-4/+4
|
* Bruce says: "You have been programming in the kernel for too long :-)."phk1996-11-131-4/+6
| | | | | | | | | | | | | | | | | 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
* Increase precision of duration to milliseconds.phk1996-11-121-2/+2
| | | | Some heuristics to avoid overflow in calculation attempted.
* Add setlocale LC_CTYPEache1995-10-231-1/+3
|
* More koshering [ul]case fix, don't use pre-initialized tables at all,ache1995-01-171-7/+11
| | | | treat 0xFF as valid character.
* Make conv=[lu]case works with localized ctype (8bit)ache1995-01-171-2/+12
|
* Added $Id$dg1994-09-241-0/+2
|
* BSD 4.4 Lite bin Sourcesrgrimes1994-05-261-0/+395
OpenPOWER on IntegriCloud