summaryrefslogtreecommitdiff
path: root/src/shred.c
AgeCommit message (Collapse)Author
2012-07-15build: shred.c: avoid i686-specific gcc -Wstrict-overflow warningJim Meyering
* src/shred.c: Avoid gcc -Wstrict-overflow warning. Addresses http://bugs.gnu.org/11927
2012-01-09maint: src/*.[ch]: convert more `...' to '...'Jim Meyering
Run this (twice): git grep -E -l '`.+'\' src/*.[ch] \ |xargs perl -pi -e 's/`(.+?'\'')/'\''$1/'
2012-01-09maint: src/*.c: change remaining quotes (without embedded spaces)Jim Meyering
Run this (twice): git grep -E -l '`[^ ]+'\' src/*.c \ |xargs perl -pi -e 's/`([^ ]+'\'')/'\''$1/'
2012-01-07maint: use new emit_try_help in place of equivalent fprintfJim Meyering
Run this command: perl -0777 -pi -e \ 's/fprintf \(stderr, _\("Try `%s --help.*\n.*;/emit_try_help ();/m'\ src/*.c
2012-01-01maint: update all copyright year number rangesJim Meyering
Run "make update-copyright".
2011-12-09maint: remove a misleading comment from shred.cJim Meyering
* src/shred.c: Remove obsolete TODO comment. The first two and the last item were done, adding --recursive (-r) is neither necessary nor appropriate, and I don't want to add --interactive. I don't see a need for the others. Prompted by comments from Amr Ali.
2011-06-13maint: use stat-size module from gnulibJames Youngman
* gnulib: Update to latest. * src/system.h: Definitions of ST_* macros have moved into the gnulib module stat-size (specifically, the header file stat-size.h), so remove them from here. * src/truncate.c: Include stat-size.h. * src/stat.c: Likewise. * src/shred.c: Likewise. * src/ls.c: Likewise. * src/du.c: Likewise. * src/ioblksize.h: New file. Move definition of io_blksize out of system.h so that system.h does not have to include stat-size.h. * src/cat.c: Include ioblksize.h. * src/split.c: Likewise. * src/copy.c: Include both stat-size.h and ioblksize.h. * src/Makefile.am (noinst_HEADERS): Add ioblksize.h.
2011-05-26shred: placate coverity and fix a commentJim Meyering
* src/shred.c (incname): Add an assertion to tell static analyzers that we know this particular use of strchr never returns NULL. Finish incomplete sentence in function-describing comment.
2011-05-19maint: correct typos involving misuse of "a" and "an"Jim Meyering
* NEWS: "an misleading" * src/expr.c: "a integer * src/ptx.c (find_occurs_in_text): "a end" * src/shred.c (do_wipefd): "a infinite" * src/sort.c (SUBTHREAD_LINES_HEURISTIC): "an dual-core" (compare_random): "an checksum" * cfg.mk (old_NEWS_hash): Update, since the typo was in old news.
2011-05-08maint: remove -Wmissing-field-initializers workaroundsPádraig Brady
* configure.ac: Rather than disabling -Wmissing-field-initializers, use the fact that gnulib now disables it automatically when required (on versions of GCC older than 4.7). * src/system.h: Remove the no longer needed DECLARE_ZEROED_AGGREGATE. * src/ls.c: Likewise. * src/pathchk.c: Likewise. * src/shred.c: Likewise. * src/stty.c: Likewise. * src/wc.c: Likewise.
2011-01-01maint: update all copyright year number rangesJim Meyering
Run "make update-copyright".
2010-05-31maint: make spacing around "=" consistent, even in IF_LINTJim Meyering
E.g., - size_t desired_width IF_LINT (= 0); + size_t desired_width IF_LINT ( = 0); Use this command: g grep -l IF_LINT | grep '\.[ch]$' \ | xargs perl -pi -e 's/(IF_LINT \()= /$1 = /'
2010-05-31maint: replace each "for (;;)" with "while (true)"Jim Meyering
Run this command: git ls-files | grep '\.[ch]$' \ | xargs perl -pi -e 's/for \(;;\)/while (true)/g' ...except for randint.c, which does not include stdbool.h. In that case, use "while (1)". * gl/lib/randint.c (randint_genmax): Use "while (1)" for infloops. * src/cat.c (simple_cat, cat): Use "while (true)" for infloops. * gl/lib/randread.c (readsource, readisaac): Likewise. * src/copy.c (copy_reg): Likewise. * src/csplit.c (record_line_starts, process_regexp): Likewise. * src/cut.c (set_fields): Likewise. * src/dd.c (iread, parse_symbols): Likewise. * src/df.c (find_mount_point, main): Likewise. * src/du.c (main): Likewise. * src/expand.c (expand): Likewise. * src/factor.c (factor_using_division, do_stdin): Likewise. * src/fmt.c (get_space): Likewise. * src/ls.c (decode_switches): Likewise. * src/od.c (main): Likewise. * src/pr.c (main, read_line): Likewise. * src/shred.c (dopass, genpattern): Likewise. * src/sort.c (initbuf, fillbuf, getmonth, keycompare): Likewise. * src/split.c (bytes_split, lines_split): Likewise. * src/tac.c (tac_seekable): Likewise. * src/test.c (and, or): Likewise. * src/tr.c (squeeze_filter, main): Likewise. * src/tsort.c (search_item): Likewise. * src/unexpand.c (unexpand): Likewise. * src/uniq.c (main): Likewise. * src/yes.c (main): Likewise.
2010-01-01maint: update all FSF copyright year lists to include 2010Jim Meyering
Use this command: git ls-files | grep -v COPYING \ | xargs env UPDATE_COPYRIGHT_USE_INTERVALS=1 \ build-aux/update-copyright
2009-09-21doc: mention the texinfo documentation in --helpPádraig Brady
* src/system.h: Rename emit_bug_reporting_address() to emit_ancillary_info() and update it to not print the translation project address in en_* locales, and _do_ print it in the 'C' (and other) locales so that it's included in the default man page. Also mention how to invoke the texinfo documentation for each command. Also move the "hard-locale.h" include to the 8 files that now use it. * man/help2man: Strip the newly added texinfo reference from the --help output as a more verbose version is already added by help2man. Suggestion from C de-Avillez
2009-09-01maint: shred: remove unnecessary initializationJim Meyering
* src/shred.c (genpattern): Value stored to "n" is never used.
2009-08-25global: convert indentation-TABs to spacesJim Meyering
Transformed via this shell code: t=$'\t' git ls-files \ | grep -vE '(^|/)((GNU)?[Mm]akefile|ChangeLog)|\.(am|mk)$' \ | grep -vE 'tests/pr/|help2man' \ | xargs grep -lE "^ *$t" \ | xargs perl -MText::Tabs -ni -le \ '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'
2009-04-07shred,sort,shuf: don't use /dev/urandom by defaultPádraig Brady
Suggestion from Steven Schveighoffer at: http://savannah.gnu.org/patch/?6797 to greatly speed up the random passes done by shred. * gl/lib/randread.c: Default to using the internal pseudorandom generator, rather than reading /dev/urandom * src/shred.c (usage): remove mention of /dev/urandom * src/shuf.c (usage); ditto * src/sort.c (usage): ditto * doc/coreutils.text: Document the new behaviour for aquiring random data.
2009-04-07maint: Clarify ambiguous refs to Linux kernels or GNU/Linux systemsPádraig Brady
* README-prereq: s_linux_GNU/Linux_ or s_linux_Linux kernel_ * README-valgrind: ditto * src/chown-core.c: ditto * src/dd.c: ditto * src/df.c: ditto * src/ls.c: ditto * src/mv.c: ditto * src/pwd.c: ditto * src/remove.c: ditto * src/shred.c: ditto * src/stat.c: ditto * src/su.c: ditto * src/system.h: ditto * src/timeout.c: ditto * src/truncate.c: ditto
2009-01-22shred: change default number of overwrites from 25 to 3Pádraig Brady
* src/shred.c: The concensus is that a default of 3 passes is appropriate for current drive technologies. * src/TODO: Reference Paul Eggert's suggestion of enhancing shred to conform to DoD 5220 rules.
2009-01-16shred: avoid -Wsign-compare warningsPádraig Brady
* src/shred.c: Use already assigned signed variable sizeof_r, rather than the unsigned sizeof(r). Don't use signed integer overflow check that contemporary compilers may remove anyway.
2008-12-01avoid warnings about initialization of automatic aggregatesJim Meyering
* src/system.h (DZA_CONCAT0, DZA_CONCAT): New macros. (DECLARE_ZEROED_AGGREGATE): New macro. * src/ls.c (quote_name): Use it. * src/pathchk.c (portable_chars_only): Use it. * src/shred.c (main): Use it. * src/stty.c (main): Use it. * src/wc.c (SUPPORT_OLD_MBRTOWC): Use it.
2008-09-19shred --help: lowercase a stray capitalBenno Schulenberg
2008-08-04doc: correct and normalize --help output of several toolsBenno Schulenberg
* src/chroot.c (usage): Add "[ARG]" to synopsis. * src/cut.c (usage): Remove an inconsistent period in an option description. * src/du.c (usage): Remove superfluous argument after short option -X. Also remove inconsistent uppercase and final period. Use a single indent level for prettiness. * src/shred.c (usage): Normalize the synopsis. * src/stty.c (usage): Options -F and --file are alternatives, cannot both be used. * src/sum.c (usage): -r does not overrule -s; the last one counts. * src/uptime.c (usage): Remove inconsistent space from the synopsis. * src/users.c: Likewise.
2008-06-27factor out time_t-to-string conversion idiomJim Meyering
* src/system.h: Include "inttostr.h". (timetostr): New function, factored out of... * src/date.c (show_date): Use timetostr. * src/du.c (show_date): Likewise. * src/ls.c (print_long_format): Likewise. * src/pinky.c (time_string): Likewise. * src/stat.c (human_time): Likewise. * src/*.c: Don't include inttostr.h, since system.h does. * src/c99-to-c89.diff: Adjust offsets.
2008-06-26shred: also ignore EISDIR upon failed fsync/fdatasync on HP-UXJim Meyering
* src/shred.c (ignorable_sync_errno): New function. (dosync): Use it. Based on a patch from Peter O'Gorman.
2008-06-16remove redundant const directivesJim Meyering
In 1463824d8e7f72c31f1d803d7cfe2b608ccafc5c, I added some missing "const" directives, as well as some new, redundant ones. This removes the redundant ones. Pointed out by Eric Blake. * base64.c, cat.c, chcon.c, chgrp.c, chmod.c, chown.c, comm.c: * cp.c, csplit.c, cut.c, date.c, dd.c, df.c, dircolors.c, du.c: * env.c, expand.c, fmt.c, fold.c, groups.c, head.c, id.c: * install.c, join.c, kill.c, ln.c, ls.c, md5sum.c, mkdir.c: * mkfifo.c, mknod.c, mktemp.c, mv.c, nice.c, nl.c, od.c: * paste.c, pathchk.c, pinky.c, pr.c, ptx.c, readlink.c, rm.c: * rmdir.c, runcon.c, seq.c, shred.c, shuf.c, sort.c, split.c: * stat.c, stty.c, su.c, sum.c, tac.c, tail.c, tee.c, timeout.c: * touch.c, tr.c, truncate.c, tty.c, uname.c, unexpand.c, uniq.c: * wc.c, who.c: Remove redundant const directives. * maint.mk (sc_const_long_option): Don't require redundant "const".
2008-06-14add "const" attribute, where possibleJim Meyering
* maint.mk (sc_const_long_option): New rule. Enforce global change. * src/base64.c (long_options): Use "const" where possible. * src/cat.c (main): Likewise. * src/chcon.c (long_options): Likewise. * src/chgrp.c (long_options): Likewise. * src/chmod.c (long_options): Likewise. * src/chown.c (long_options): Likewise. * src/comm.c (long_options, OUTPUT_DELIMITER_OPTION): Likewise. * src/cp.c (long_opts): Likewise. * src/csplit.c (longopts): Likewise. * src/cut.c (longopts): Likewise. * src/date.c (long_options): Likewise. * src/dd.c (conversions, flags, statuses): Likewise. * src/df.c (long_options): Likewise. * src/dircolors.c (long_options): Likewise. * src/du.c (long_options): Likewise. * src/env.c (longopts): Likewise. * src/expand.c (longopts): Likewise. * src/fmt.c (long_options): Likewise. * src/fold.c (longopts): Likewise. * src/groups.c (longopts): Likewise. * src/head.c (long_options): Likewise. * src/id.c (longopts): Likewise. * src/install.c (long_options): Likewise. * src/join.c (longopts): Likewise. * src/kill.c (long_options): Likewise. * src/ln.c (long_options): Likewise. * src/ls.c (long_time_format, long_options, sort_functions): Likewise. * src/md5sum.c (long_options): Likewise. * src/mkdir.c (longopts): Likewise. * src/mkfifo.c (longopts): Likewise. * src/mknod.c (longopts): Likewise. * src/mktemp.c (longopts): Likewise. * src/mv.c (long_options): Likewise. * src/nice.c (longopts): Likewise. * src/nl.c (longopts): Likewise. * src/od.c (charname, long_options): Likewise. * src/paste.c (longopts): Likewise. * src/pathchk.c (longopts): Likewise. * src/pinky.c (longopts): Likewise. * src/pr.c (long_options): Likewise. * src/ptx.c (long_options): Likewise. * src/readlink.c (longopts): Likewise. * src/rm.c (long_opts): Likewise. * src/rmdir.c (longopts): Likewise. * src/runcon.c (long_options): Likewise. * src/seq.c (long_options): Likewise. * src/shred.c (long_opts): Likewise. * src/shuf.c (long_opts): Likewise. * src/sort.c (monthtab, long_options): Likewise. * src/split.c (longopts): Likewise. * src/stat.c (long_options): Likewise. * src/stty.c (mode_info, control_info, longopts, set_mode) Likewise. (set_control_char, speeds): Likewise. * src/su.c (longopts): Likewise. * src/sum.c (longopts): Likewise. * src/tac.c (longopts): Likewise. * src/tail.c (long_options): Likewise. * src/tee.c (long_options): Likewise. * src/timeout.c (long_options): Likewise. * src/touch.c (longopts): Likewise. * src/tr.c (long_options): Likewise. * src/truncate.c (longopts): Likewise. * src/tty.c (longopts): Likewise. * src/uname.c (uname_long_options, arch_long_options): Likewise. * src/unexpand.c (longopts): Likewise. * src/uniq.c (longopts): Likewise. * src/wc.c (longopts): Likewise. * src/who.c (longopts): Likewise.
2008-06-03use gnulib's progname moduleJim Meyering
* bootstrap.conf (gnulib_modules): Add progname. * src/*.c (program_name): Remove declaration. * (main): Call set_program_name rather than setting program_name. * src/nice.c (main): Cast program_name to "(char *)". * src/prog-fprintf.c: Include "system.h" * src/system.h: Include "progname.h". * maint.mk (sc_program_name): Adjust rule. Suggestion from Eric Blake.
2008-05-26adjust copyright datesJim Meyering
2008-05-26convert single-author programs to use proper_nameJim Meyering
g grep -E -l 'define AUTHORS "[^,]+"$'|xargs perl -pi -e \ 's/(define AUTHORS) ("[^,]+")$/$1 proper_name ($2)/'
2007-12-04Reflect change in gnulib: don't include getpagesize.h,Jim Meyering
now that it's provided by unistd.h. * src/cat.c: Don't include getpagesize.h. * src/copy.c: Likewise. * src/dd.c: Likewise. * src/shred.c: Likewise. * src/split.c: Likewise.
2007-07-23Update all copyright notices to use the newer form.Jim Meyering
2007-07-10Change "version 2" to "version 3" in all copyright notices.Jim Meyering
2007-06-15Don't include "quote.h" when it is not used.Jim Meyering
* src/md5sum.c: Remove unnecessary inclusion of "quote.h". * src/expr.c: Likewise. * src/shred.c: Likewise. * Makefile.maint (sc_prohibit_quote_without_use): New rule. * src/c99-to-c89.diff: Adjust offsets.
2007-03-28Help translators include translation team's web or email address.Jim Meyering
* src/system.h (emit_bug_reporting_address): New function. * src/base64.c: Use it rather than a literal printf. * src/basename.c, src/cat.c, src/chgrp.c, src/chmod.c: * src/chown.c, src/chroot.c, src/cksum.c, src/comm.c, src/cp.c: * src/csplit.c, src/cut.c, src/date.c, src/dd.c, src/df.c: * src/dircolors.c, src/dirname.c, src/du.c, src/echo.c, src/env.c: * src/expand.c, src/expr.c, src/factor.c, src/fmt.c, src/fold.c: * src/head.c, src/hostid.c, src/hostname.c, src/id.c, src/install.c: * src/join.c, src/kill.c, src/link.c, src/ln.c, src/logname.c: * src/ls.c, src/md5sum.c, src/mkdir.c, src/mkfifo.c, src/mknod.c: * src/mv.c, src/nice.c, src/nl.c, src/nohup.c, src/od.c: * src/paste.c, src/pathchk.c, src/pinky.c, src/pr.c, src/printenv.c: * src/printf.c, src/ptx.c, src/pwd.c, src/readlink.c, src/rm.c: * src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c, src/shuf.c: * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c: * src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac.c: * src/tail.c, src/tee.c, src/test.c, src/touch.c, src/tr.c: * src/true.c, src/tsort.c, src/tty.c, src/uname.c, src/unexpand.c: * src/uniq.c, src/unlink.c, src/uptime.c, src/users.c, src/wc.c: * src/who.c, src/whoami.c, src/yes.c: Likewise.
2006-11-27Improve the check for departures from C89, and fix the departuresPaul Eggert
I found. * Makefile.maint (my-distcheck): Also check for C89 compatibility as best we can with GCC. * src/stat.c (PRINTF_OPTION): Omit comma before } in enum declaration; C89 doesn't allow this. * src/dcgen: Don't generate string literals longer than what C89 requires support for. * src/cut.c (usage): Don't use string literals longer than what C89 requires support for. * src/date.c (usage): Likewise. * src/dd.c (usage): Likewise. * src/du.c (usage): Likewise. * src/ls.c (usage): Likewise. * src/od.c (usage): Likewise. * src/readlink.c (usage): Likewise. * src/seq.c (usage): Likewise. * src/shred.c (usage): Likewise.
2006-10-10* src/ls.c (quote_name): Use initializer rather than memset toPaul Eggert
initialize an object to zero. This is easier to read and is less likely to introduce an runtime error due to a mixup. It causes gcc -W to issue a warning, but you can work around this by appending -Wno-missing-field-initializers. * src/pathchk.c (portable_chars_only): Likewise. * src/shred.c (main): Likewise. * src/stty.c (main): Likewise. * src/tr.c (card_of_complement): Likewise. * src/wc.c (wc): Likewise.
2006-09-03Don't include dirname.h, since system.h does it now.Paul Eggert
2006-08-26Include <config.h> unconditionally, since we now assume config.h exists.Paul Eggert
2006-08-25Fix typo in previous checkin; a "&" went missing.Paul Eggert
2006-08-25Rewrite to avoid some unnecessary casts, macros, literals.Paul Eggert
(DEFAULT_PASSES, VERBOSE_UPDATE): Now constants, not macros. (SECTOR_SIZE, SECTOR_MASK): New constants. (fillpattern, dopass, do_wipefd, main): Remove unnecessary casts, and use the SECTOR_* constants when applicable. Check for size < 0 rather than size == -1, since negative-size files are a sign of trouble anyway. (dopass): Assume a continuable error if EIO even if the current position is not a multiple of 512.
2006-08-13* src/shred.c (usage): Don't indent the second line of an item.Jim Meyering
Otherwise, help2man would misformat the output. Reported by Adam Buchbinder in <https://launchpad.net/bugs/48917>.
2006-08-08Use new random-number interface rather than rand-isaac.c.Paul Eggert
Don't include rand-isaac.c; include randint.h and randread.h instead. (RANDOM_SOURCE_OPTION): New enum. (long_opts, usage, main): New option --random-source. (struct irand_state, irand_init, irand32, irand_mod): Remove. All callers changed to use randint interface. (fillrand): Remove. All callers changed to use randread interface. (dopass): Remove dependency on ISAAC buffer size. (genpattern): Don't wipe the random state here. (randint_source): New static var. (clear_random_data): New function. (main): Allocate random source, and arrange to wipe it on exit.
2006-04-19(fillrand): The assertion was way too weak, due toPaul Eggert
what must be a typo. Strengthen it to its intended value. (dopass): Don't use alloca; it's not worth the aggravation here, since it's used only to get a page-aligned buffer, and page alignment doesn't buy us much here. I'm suspicious that alloca causes problems on some hosts, due to a recent bug report by Adam Waltman.
2006-03-26(wipename): Use new last_component, in place of base_name.Jim Meyering
2005-12-27(wipename): Use similar open flags to other places we open directories.Paul Eggert
Don't bother trying to open dir for writing, since POSIX prohibits it.
2005-12-12(struct irand_state, irand_init, irand32, irand_mod): Moved back here,Paul Eggert
from rand-isaac.c.
2005-12-12Include rand-isaac.c rather than rand-isaac.h.Paul Eggert
(fillrand, dopass, main): Undo previous change.
2005-12-10Don't include gethrxtime.h. No longer needed.Jim Meyering