Age | Commit message (Collapse) | Author |
|
|
|
(UINT_MAX_DECIMAL_DIGITS, uint_to_string): Remove.
(gid_to_name, uid_to_name): Use imaxtostr/umaxtostr
instead of uint_to_string).
(describe_change): Instead of an int flag, use a char *
auxiliary; this avoids the need for casts.
Assume free (NULL) works.
(change_file_owner): Return true/false, not 0/-1, since
we don't set errno. All callers changed.
Use bool when appropriate.
(chown_files): Likewise.
|
|
|
|
(main): int -> bool when appropriate.
|
|
|
|
|
|
(localedir.h): Don't depend on Makefile: this causes Solaris
8 'make' to build localedir.h unnecessarily. The dependence
on Makefile is ineffective anyway, since $(localedir) might
change even if Makefile hasn't.
|
|
working directory, pretend we started from "/", not ".".
This avoids a bug on hosts like Solaris that don't let you
remove the working directory.
|
|
declared: this fixes a portability bug with Solaris 8 + GCC.
(STRTOX): Parenthesize use of macro arg as expression.
(vstrtoimax, vstrtoumax, vstrtold): Remove now-unnecessary
parentheses.
|
|
|
|
pathchk_LDADD, rm_LDADD, test_LDADD): New vars, for eaccess.
|
|
bother to check for this.
|
|
bother to check for this.
|
|
returns NULL, so don't bother to check for this.
|
|
|
|
All uses changed.
(NZERO): New macro, if system doesn't define it already.
(usage): Distinguish priorities from nice values.
Don't assume NZERO is 20.
(main): Use bool instead of int where appropriate.
If user specifies an adjustment out of range, always truncate it
to an inrange value instead of sometimes giving an error message
and sometimes not.
Do not assume that -1 is an error return from "nice" or
"getpriority", as it might be the current nice value minus NZERO.
If nice/setpriority fails with errno == EPERM, go ahead and run
the command anyway; POSIX requires this.
|
|
|
|
(eaccess): Remove. All users changed to use euidaccess instead.
|
|
(dir_ok): Use euidaccess, not access.
|
|
Don't assume ut_line is null-terminated.
|
|
might not be null terminated. All callers changed.
|
|
|
|
(COPY_TO_EOF): Set to UINTMAX_MAX, not OFF_T_MAX (which was wrong).
(COPY_A_BUFFER): New macro.
(struct File_spec): New members mtime, mode, blocking.
Remove member n_consecutive_size_changes.
(DEFAULT_MAX_N_CONSECUTIVE_SIZE_CHANGES,
max_n_consecutive_size_changes_between_opens,
MAX_CONSECUTIVE_SIZE_CHANGES_OPTION): Remove.
(long_options, tail_forever, parse_options):
Remove (non-)support for --max-consecutive-size-changes.
(record_open_fd): New function.
(recheck, tail_file): Use it. Don't assume that stdin is open.
(dump_remainder): Add support for new COPY_A_BUFFER special value.
Treat errno==EAGAIN like EOF, since it might be a nonblocking read.
(recheck): New arg BLOCKING, specifying whether to use blocking reads.
All uses changed.
(n_live_files): Remove, replacing with...
(any_live_files): New function. All uses changed.
(tail_forever): Use nonblocking I/O unless we know that blocking I/O
is safe; this avoids some hangs when reading from a fifo.
Avoid invoking fstat or sleep when using blocking I/O.
Do not check for changes to size if the file is not a regular file,
as the size is undefined in that case.
Check for changes to mtime or mode, too; this works for non-regular
files.
(tail_forever, main): Redo fflush strategy to work even when input
is nonblocking. Don't use unbuffered output; just flush when needed.
|
|
and standard input is a pipe.
|
|
(print_uptime): Use c_strtod instead of setlocale and sscanf.
Use long int rather than int to count days (for 64-bit hosts),
and check for arithmetic overflow when converting double to time_t.
|
|
|
|
Now returns long double. All uses changed.
(print_direc): Use "L" length modifier when printing floating point
numbers, since we're now printing long double.
|
|
|
|
formats that Bash supports, and to support wide integers like
Bash does.
(UNSPECIFIED): Remove. All uses now replaced by
booleans, so that we don't reserve any values for precision or
width (like Bash).
(STRTOX): Use prototype, not K&R-style definition.
(vstrtoimax): Renamed from xstrtol (to avoid confusion with xstrtol
in ../lib), with type change to intmax_t.
All uses changed.
(vstrtoumax): Renamed from xstrtoul, with type change to uintmax_t.
All uses changed.
(vstrtod): Renamed from xstrtod. All uses changed.
(print_direc): Use boolean arg instead of special value to indicate
a missing precision or width. LENGTH no longer includes
length modifiers or conversion character. New arg CONVERSION
now specifies conversion character.
Use intmax_t-width formatting for integers (like Bash).
Add support for C99 %a, %A, %F (like Bash).
Add support for field width with %c (POSIX requires this).
Add a FIXME for lack of support for field width and precision
for %b.
Add support for '\'', '0' flags.
Check for invalid combinations of flags, field width, precision,
and conversion, to prevent use of undefined behavior.
Allow multiple length modifiers, for formats like "%lld" (like Bash).
Add support for C99 'j', 't', 'z' length modifiers (like Bash).
In error message, output entire invalid conversion specification,
instead of merely outputting % followed by the conversion char.
|
|
Add more canonicalize options, -e and -m.
Add comprehensive tests for all readlink modes.
(longopts): Add new options.
(usage): Document them.
(canonicalize_fname): New proxy function.
(main): Handle new options.
|
|
|
|
This cleans up the semantics a bit, as we no longer try to open the
same file twice.
|
|
|
|
(make_path_private): 2nd arg is now size_t, not int,
to avoid problem when path_concat dir name is longer than 2 GiB (!).
|
|
|
|
and --no-target-directory options, respectively.
(NO_TARGET_DIRECTORY_OPTION, TARGET_DIRECTORY_OPTION):
Remove. All uses changed to 'T' and 't', respectively.
(long_options, main, usage): Add -t and -T as
aliases for --target-directory and --no-target-directory,
respectively.
|
|
and --no-target-directory options, respectively.
(NO_TARGET_DIRECTORY_OPTION, TARGET_DIRECTORY_OPTION):
Remove. All uses changed to 'T' and 't', respectively.
(long_opts, usage, do_copy, main): Add -t and -T as
aliases for --target-directory and --no-target-directory,
respectively.
|
|
|
|
|
|
|
|
(long_options, usage): Rename "--filesystem" to
"--file-system". But keep the old name around, for compatibility reasons.
|
|
|
|
|
|
(NO_TARGET_DIRECTORY_OPTION): New constant.
(long_options, usage, main): Add support for
|
|
(NO_TARGET_DIRECTORY_OPTION): New constant.
(long_options, usage, main): Add support for
(enum): Sort values.
|
|
(NO_TARGET_DIRECTORY_OPTION): New constant.
(long_options, usage, main): Add support for
|
|
(NO_TARGET_DIRECTORY_OPTION): New constant.
(long_opts, usage, do_copy, main): Add support for
|
|
that has been documented for years but not implemented (!).
(TARGET_DIRECTORY_OPTION): New var.
(long_options, main, usage): Add --target-directory.
(target_directory_operand): New function, stolen from mv.c.
(main): Use it. Check for -d and --target-directory.
Alter wording of diagnostics to match other programs.
|
|
last operands that are (or look like) directories.
* src/cp.c (target_directory_operand): New, nearly-common function,
It reports an error if the destination appears to be a directory
(e.g., because it has a trailing slash) but is not.
* src/ln.c, src/mv.c: Likewise.
* src/cp.c (do_copy): Use it.
* src/ln.c (main): Likewise.
* src/mv.c (main): Likewise.
* src/cp.c (do_copy): Don't output a usage message because of file
problems (e.g., an operand is not a directory). Use it only for
syntax. Standardize on "target %s is not a directory" for the
diagnostic.
* src/ln.c (main): Likewise.
* src/mv.c (main): Likewise.
* src/cp.c (do_copy): Remove test for trailing slash, since
target_directory_operand now does this.
* src/ln.c (main): Likewise.
* src/mv.c (movefile): Likewise.
* src/ln.c (isdir): Remove decl; no longer needed.
* src/mv.c (isdir, lstat): Likewise.
* src/ln.c (main): Use int to count to argc, not unsigned int.
This handles negative operand counts.
* src/mv.c (main): Likewise.
* src/mv.c (do_move): Don't call hash_init; expect the caller to
do it, for consistency with cp.c and ln.c. All callers changed.
(movefile): dest_is_dir parameter is now bool, not int.
(main): Standardize on "missing destination file operand after %s"
for the diagnostic, for consistency with cp.c.
|
|
last operands that are (or look like) directories.
* src/cp.c (target_directory_operand): New, nearly-common function,
It reports an error if the destination appears to be a directory
(e.g., because it has a trailing slash) but is not.
* src/ln.c, src/mv.c: Likewise.
* src/cp.c (do_copy): Use it.
* src/ln.c (main): Likewise.
* src/mv.c (main): Likewise.
* src/cp.c (do_copy): Don't output a usage message because of file
problems (e.g., an operand is not a directory). Use it only for
syntax. Standardize on "target %s is not a directory" for the
diagnostic.
* src/ln.c (main): Likewise.
* src/mv.c (main): Likewise.
* src/cp.c (do_copy): Remove test for trailing slash, since
target_directory_operand now does this.
* src/ln.c (main): Likewise.
* src/mv.c (movefile): Likewise.
* src/cp.c (main): Reject multiple target directories.
Check whether a specified target is a directory when parsing the
options, using stat. This gives more-accurate diagnostics.
* src/ln.c (main): Likewise.
* src/ln.c (isdir): Remove decl; no longer needed.
* src/mv.c (isdir, lstat): Likewise.
* src/ln.c (do_link): New arg dest_is_dir. All uses changed.
Don't check the destination ourself; rely on dest_is_dir.
This way we can avoid lstatting the destination in the
usual case, and in the worst case we lstat 1, not 3 times.
Don't bother to unlink unless link failed; this saves a syscall.
Remove unnecessary backup_succeeded flag;
it was identical to "dest_backup != NULL".
* src/ln.c (main): Use int to count to argc, not unsigned int.
This handles negative operand counts.
* src/mv.c (main): Likewise.
|