Commit Graph

2564 Commits

Author SHA1 Message Date
Jim Meyering 37c05b6267 Include assert.h.
(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.
2000-10-28 11:49:52 +00:00
Jim Meyering 141a1086a2 (usage): Mention the time zone, UTC, and write the date
in ISO format in the description of %s.  Suggestion from Karl Berry.
2000-10-26 22:36:39 +00:00
Jim Meyering 9d29159931 Include dirname.h.
(main): Use dir_name_r rather than open-coding it.
2000-10-25 08:39:29 +00:00
Jim Meyering 0622127ac6 include stdio.h 2000-10-22 21:11:53 +00:00
Jim Meyering c66278dffc renamed from shasum.c 2000-10-22 14:19:52 +00:00
Jim Meyering 1bc1a37f86 fix typo 2000-10-22 14:03:33 +00:00
Jim Meyering 1f2219cabf (print_long_format): Wrap date format strings in _(...)
so they may be internationalized.  Suggestion from Christian Rose.
2000-10-22 13:15:22 +00:00
Jim Meyering f0d9306c78 (make_path_private): Add a FIXME comment. 2000-10-22 13:10:20 +00:00
Jim Meyering cf806f5d2d . 2000-10-22 11:51:50 +00:00
Jim Meyering 148e5d1b4d Factor out the differences between MD5 and SHA1,
and parameterize so this code may be used by both md5sum and the new
program, shasum.  Loosely based on a patch from Scott Miller.
2000-10-22 11:50:16 +00:00
Jim Meyering 8a149d2242 Support 8-byte integers, assuming they're printable with e.g., %lld.
Add support for printing data as unsigned
long long integers.
2000-10-22 07:33:21 +00:00
Jim Meyering b84871a279 add missing backslash 2000-10-22 07:20:24 +00:00
Jim Meyering 13e80acf07 The command, `yes ''|./cat -n' would stop printing after INT_MAX lines.
(cat): Never let `newlines' exceed 3.
2000-10-21 19:57:41 +00:00
Jim Meyering 51e2ffc524 Prevent a counter buffer overrun when numbering lines and when
processing 100 billion lines (or more) of input.

(LINE_COUNTER_BUF_LEN): Define to allow numbering as
many as 10^18 - 1 lines (the old limit was 10^11 - 1, and could
be exceeded without too much trouble).	Use this symbol rather
than hard-coding the constant everywhere.  Rather than overruning
for input with more lines, mark the line number by putting a
`>' in the leftmost slot.
(next_line_num): Fixed (now academic) possible line buffer overrun.
Patch by Jan Nieuwenhuizen.
2000-10-21 19:16:37 +00:00
Jim Meyering fb5e934c73 (SORT_OUT_OF_ORDER): Define.
(main): Use it instead of hard-coding the `1'.
2000-10-21 13:05:40 +00:00
Jim Meyering 09ad98374b (main): Use EXIT_SUCCESS rather than 0.
Fail when checking (-c) with more than one file argument,
rather than simply ignoring the extra arguments.
2000-10-21 13:03:40 +00:00
Jim Meyering 7243403b27 (universal_time): Remove; it's just a temptation to do the wrong thing.
(main): The -u option now just sets TZ; it doesn't do anything else.
(show_date): Do not do anything special if -u is set.
This affects the behavior of the -I and -R options.
2000-10-18 20:47:25 +00:00
Jim Meyering 29a4bf90d3 Undo the effect of the 1997-07-12 change to date.c; it
broke "date -u MMDDhhmm" and it wasn't documented.
This reverts to the behavior of the 1996-01-03 patch.

(TZ_UTC0, MAYBE_SET_TZ_UTC0, set_tz): Remove.
(batch_convert): Don't futz with TZ.
(main): -u now parses all dates as UTC, not just some.
2000-10-18 19:02:56 +00:00
Jim Meyering fd00df9c4d fix spell-o in comment 2000-10-16 08:10:58 +00:00
Jim Meyering d15557db96 (rm_option_init): Remove FIXME-maybe comment. 2000-10-16 08:09:57 +00:00
Jim Meyering ad09410b04 (main): Rename local symbolic_mode' to specified_mode'. 2000-09-30 09:40:56 +00:00
Jim Meyering f8e66794d9 (change_file_mode): Perform the chmod even if the
file mode permission bits are the same as those that should be set.
Omitting the chmod call would be alright with minimal 1003.1e DS17
ACLs, but eventually there will be other permissions in addition to
rwx.  E.g., add and delete for directories, and something analogous
to NT's take ownership permission.
2000-09-30 09:39:41 +00:00
Jim Meyering e2b45cb9fe (main): Don't set the umask to 0 and hand-apply
the previously-set umask unconditionally.  Do that only when a
MODE has been specified.  Otherwise, call mkfifo with the full
creation mask (0777 or 0666) and let the kernel apply the umask.
The difference shows up only on file systems with ACL support
when the containing directory has a default ACL.
Patch by Andreas Gruenbacher.
(main): Rename local `symbolic_mode' to `specified_mode'.
Also, when MODE is specified, call chmod to ensure that the
permission bits are set as specified even when the containing
directory has a default ACL.
2000-09-30 08:56:06 +00:00
Jim Meyering 2170a48956 (main): Rename local symbolic_mode' to specified_mode'. 2000-09-30 08:53:27 +00:00
Jim Meyering beebc69168 (main): Don't set the umask to 0 and hand-apply
the previously-set umask unconditionally.  Do that only when a
MODE has been specified.  Otherwise, call mknod with the full
creation mask (0777 or 0666) and let the kernel apply the umask.
The difference shows up only on file systems with ACL support
when the containing directory has a default ACL.
Patch by Andreas Gruenbacher.
(main): Rename local `symbolic_mode' to `specified_mode'.
Also, when MODE is specified, call chmod to ensure that the
permission bits are set as specified even when the containing
directory has a default ACL.
2000-09-30 08:53:10 +00:00
Jim Meyering daf9d41918 (main): Rename local symbolic_mode' to specified_mode'. 2000-09-30 08:49:51 +00:00
Jim Meyering 105cbe3ea3 (main): Don't set the umask to 0 and hand-apply
the previously-set umask unconditionally.  Do that only when a
MODE has been specified.  Otherwise, call mkdir with the full
creation mask (0777 or 0666) and let the kernel apply the umask.
The difference shows up only on file systems with ACL support
when the containing directory has a default ACL.
Patch by Andreas Gruenbacher.
2000-09-30 08:49:17 +00:00
Jim Meyering c217428f39 (main): Rename local symbolic_mode' to specified_mode'. 2000-09-30 08:20:23 +00:00
Jim Meyering 41939d7bfe Remove option-describing comment block. 2000-09-30 08:19:34 +00:00
Jim Meyering 55b181511c (usage): Add a separate usage line, just for `OPTION'. 2000-09-29 21:40:38 +00:00
Jim Meyering 8879e63dee (long_opts): --exact doesn't take an argument. 2000-09-25 22:37:54 +00:00
Jim Meyering 3283bb8b93 (usage): Match revised documentation better. 2000-09-25 00:09:10 +00:00
Jim Meyering 65b0c96d46 (main): Tweak a relatively new diagnostic. 2000-09-24 11:57:36 +00:00
Jim Meyering a04e5b9dbc (main): When used with --force, each of the --link and
--symbolic-link options now implies --remove-destination.
2000-09-22 20:41:40 +00:00
Jim Meyering 39da0cbc3b (cp_option_init): Once again make it so install always
unlinks an existing destination before trying to open it for writing.
Otherwise, installing onto a running shared library would make the
running program malfunction.
2000-09-22 19:30:29 +00:00
Jim Meyering c2c680ad95 (do_move): Moving a directory specified with a trailing
slash from one partition to another, and giving it a different
name at the destination would cause mv to get a failed assertion.
Reported by Michael Stone.
(strip_trailing_slashes_2): Move function definition to precede new first use.
2000-09-22 15:40:43 +00:00
Jim Meyering 483f907eb8 (copy_internal): Don't try to unlink directories when
using --remove-dest with -R.
2000-09-22 14:14:55 +00:00
Jim Meyering 1352d5e6ce (usage): Make second `Usage' line more precise
(also making it match the texinfo documentation).
2000-09-09 16:33:59 +00:00
Jim Meyering 7ce4ee180b (copy_internal): Call chmod also if we've made the
preceding chown call and we're supposed to preserve some special
permission bit(s) that would have been reset by chown.
Reported by Greg Louis.
2000-09-09 07:32:36 +00:00
Jim Meyering 84d9e6f35b (SAME_OWNER, SAME_GROUP, SAME_OWNER_AND_GROUP): Define.
(copy_internal): Avoid calling chown if we know it's not necessary.
2000-09-09 07:29:38 +00:00
Jim Meyering 93fe4a3b72 (S_IRWXUGO): Define here, instead. 2000-09-08 09:01:32 +00:00
Jim Meyering 3a66ad8dcd (S_IRWXUGO): Remove definition. 2000-09-08 09:01:02 +00:00
Jim Meyering 95ed06eb09 (usage): Note that when using -f, lines with no delimiters are also printed. 2000-09-07 07:08:17 +00:00
Jim Meyering 19ee58e090 Remove obsolete comment block. 2000-09-07 07:01:11 +00:00
Jim Meyering 106eedf2a8 Remove declaration of lstat, now that it's in copy.h. 2000-09-04 20:51:29 +00:00
Jim Meyering cec4418796 Move declaractions of lstat, stat, and rpl_lstat
as well as the definition of lstat from cp.c to this file.
2000-09-04 20:51:12 +00:00
Jim Meyering 25e0824d28 Move declaractions of lstat, stat, and rpl_lstat
as well as the definition of lstat from here to copy.h.
2000-09-04 20:50:45 +00:00
Jim Meyering 4cb0cadf96 (do_link): Tweak diagnostics. 2000-09-04 15:22:00 +00:00
Jim Meyering b5545e03db (same_file_ok): Hoist a test. 2000-09-04 14:49:30 +00:00
Jim Meyering 616d9920c0 factor out backup/same test, put it after if-else. 2000-09-04 14:45:42 +00:00