Age | Commit message (Collapse) | Author |
|
Patch by Michael Stone.
|
|
It's already included via system.h.
|
|
Instead, include "xalloc.h".
|
|
They're already defined in sys2.h.
|
|
|
|
Use primitives from inttostr.h, not human.h, to print large numbers simply.
(OUTPUT_BLOCK_SIZE): remove.
(dopass): When printing progress, use floor for what has been done
so far (since we should be conservative there), and ceiling for
what needs to be done (since that's what other programs use).
|
|
|
|
`exit (1)' to `exit (EXIT_FAILURE)', and
`usage (1)' to `usage (EXIT_FAILURE)'.
|
|
|
|
|
|
(wipename): Quote file names only when necessary.
(main): Copy quoted string into malloc'd storage so it doesn't
get clobbered when using -u and --verbose.
Minor clean-up.
* src/shred.c:
Use `NULL' rather than `(time_t *) 0'.
(dopass): Use STREQ in place of strcmp.
Add parentheses around use of nested ternary operator.
|
|
(dopass): If verbose, output a line every VERBOSE_UPDATE seconds,
and suppress duplicate output lines. Output a percentage as well
as a count of bytes.
Also, fix comment/code typo regarding how many bytes have been
written; this typo was harmless before, but is no longer harmless with
the above change in effect.
|
|
|
|
|
|
code in lib/ for compiling this program without config.h.
|
|
|
|
is a valid suffix, assume 1. "MB" now means decimal, "MiB" binary.
Accept 'K' as well as 'k'.
|
|
instead of hard-coding --help and --version descriptions.
|
|
(main): Don't `call' GETTIMEOFDAY_INIT.
|
|
for short options too.''
|
|
the --version option, so this message is consistent with all the rest.
|
|
descriptions are alone in their own string.
|
|
Use fputs, not printf.
|
|
|
|
|
|
(main): `Call' GETTIMEOFDAY_INIT, just in case the code ever changes
to make it necessary.
|
|
|
|
downcase bulleted items
remove some periods
|
|
some of the filesystem types on which shred is not effective.
|
|
|
|
Use UINT_MAX_32_BITS in the cpp conditions that determine
the `word32' typedef. Using a literal `0xffffffff' failed with
HPUX10.20's /bin/cc.
|
|
that would use the PPC mfspr `asm' code.
|
|
(fillrand): Add a parameter, size_max.
Add an assertion.
Adjust caller.
(dopass): Break out of the `for (;;)' loop if size < offset.
That can happen now that dopass is called with SIZE == -1.
(do_wipefd): Accept a length of zero only for a regular file.
If lseek fails or returns 0 for a non-regular file, let dopass
determine the length.
Inspired by a patch from Alan Iwi.
|
|
|
|
|
|
|
|
corresponding argument in a `quote (...)' call.
|
|
Remove FIXME comment.
|
|
|
|
sys/stat.h or system.h. From John David Anglin.
|
|
|
|
sys/stat.h or system.h. From John David Anglin.
|
|
and shorter, skip to the next shorter length length if a rename fails (e.g. due to
permission denied). Otherwise, this loop would iterate for so long that shred would
appear to be stuck in an infinite loop for any but the shortest file names.
|
|
Remove the `R'.
|
|
|
|
things like #define const, and this must be done before
including any system headers.
|
|
Use -u instead of -R for --remove, so that we can preserve
future compatibility with rm.
|
|
(do_wipefd): Use ST_BLKSIZE instead of referring to the st_blksize
member directly.
|
|
"human.h", "xalloc.h": Include.
(attribute): Remove; no longer needed.
(xstrdup): New decl.
(STDOUT_FILENO): New macro.
(O_NOCTTY): Make sure it's always defined, even if HAVE_CONFIG_H.
The following changes have effect only if !HAVE_CONFIG_H.
<ctype.h>: New include.
(RETSIGTYPE): Remove bogus semicolon at end.
(STDOUT_FILENO, uintmax_t, human_readable, LONGEST_HUMAN_READABLE):
New macros.
(xstrtoumax): Renamed from xstrtoul, with corresponding type changes.
Handle suffixes like the real routine does.
(error): Remove bogus assignment of errno to errnum.
(xmalloc, xstrdup): New functions.
(O_NOCTTY): Define even if !HAVE_CONFIG_H.
(S_ISFIFO, S_ISSOCK): New macros, if not already defined.
(OUTPUT_BLOCK_SIZE): New macro.
(struct Options.verbose): Now a boolean, since we no longer have two
levels of verbosity.
(long_opts, usage, main): Remove -D or --device option. Invert -p or
--preserve option, and rename it to -R or --remove.
(usage): Describe G suffix.
(usage): "-" no longer conflicts with -v.
(UCHAR_MAX): Indent `#error' so that SunOS 4.1.4 cc doesn't reject it.
(ind): Portability fixes: return word32, not unsigned; multiply by
sizeof (word32) instead of shifting left by 2.
(isaac_refill, isaac_mix): Comment out size of array parameter, as
ansi2knr mishandles this.
(status_visible, status_pos, pfstatus, flushstatus): Remove, since
pfstatus isn't portable to users with varying width fonts, or
internationalized messages, and vfprintf is problematic. All callers
of pfstatus changed to use error instead; this removes incompatibility
of -v with -. All calls to flushstatus removed.
(dopass, do_wipefd): Do not translate non-English msgs with gettext.
(dopass): Cast lseek constant arguments to (off_t) for benefit
of pre-ANSI compilers; fix one lseek call whose args were interchanged.
Remove unnecessary casts to (off_t). Do not check for EIO
when determining file size; this was just my earlier wild guess.
Use human_readable to print off_t, instead of casting to unsigned long
(which doesn't work in Solaris 2.6, where off_t is longer than long).
Output human-readable sizes, instead of always using "K".
Check for offset overflow (it happened to me in SunOS 4.1.4).
(do_wipefd): Do not insist on regular files, but do check for special
files that cannot possibly be shredded.
Use xmalloc instead of malloc + check.
Do not inspect st_size for non-regular files.
Try to find the size of a non-regular file by seeking to its end.
Do not assume that a regular file of size-0 has unknown size.
Check for regular files with negative sizes,
and for overflow after rounding to next block.
Always try to truncate, even for special files, but do not report an
error if truncation fails on a special file.
(dopass, wipefile): Do not return 1 for special files; the caller
doesn't care any more.
(wipefd): Remove unnecessary (and nonportable) check for
whether the file descriptor is read-only. Remove
no-longer-needed check for `-v -'.
(incname): Return 1 for carry bit, like the documentation says.
(wipename, wipefile): Accept new argument, specifying the
quoted file name. All callers changed.
(wipename): Use xstrdup instead of strdup+error check.
(wipefile): Check for ENOTDIR when opening /dev/fd/NNN. Check for
errors in NNN more carefully. Restore errno after the check.
Check for errors when closing the file descriptor.
Use more consistent wording when unable to remove a file.
(main): Do not remove files by default.
Use xstrtoumax instead of xstrtoul uniformly, since xstrtoul won't
exist if !HAVE_CONFIG_H.
In diagnostics, quote invalid operands to -n and -s options.
Allow T, P, E, Z, and Y suffixes in -s operand.
flags.verbose is now a boolean, not a counter.
Use STDOUT_FILENO instead of 1, for clarity.
|
|
[!HAVE_CONFIG_H]: Include string.h here.
[!HAVE_CONFIG_H]: Hard-code RETSIGTYPE to `int'.
(sigill_handler): Change return type and type of local `oldhandler' to
RETSIGTYPE.
(isaac_seed_machdep): Change and type of local `oldhandler' to
RETSIGTYPE.
|