summaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorLines
2004-07-28(main): int -> bool when appropriate.Paul Eggert-6/+6
2004-07-28(parse_group): Require base 10 when parsing groups as integers.Paul Eggert-17/+8
(main): int -> bool when appropriate.
2004-07-28Regenerate.Paul Eggert-55/+8
2004-07-28Regenerate.Paul Eggert-8/+3
2004-07-28this causes Solaris 8 'make' to refuse to build "groups".Paul Eggert-7/+2
(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.
2004-07-28(remove_dir): If we can't save the state of thePaul Eggert-3/+6
working directory, pretend we started from "/", not ".". This avoids a bug on hosts like Solaris that don't let you remove the working directory.
2004-07-28(strtiomax, strtoumax): Declare if not alreadyPaul Eggert-4/+11
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.
2004-07-28Regenerate.Paul Eggert-20/+17
2004-07-28(cp_LDADD, ginstall_LDADD, mv_LDADD,Paul Eggert-0/+8
pathchk_LDADD, rm_LDADD, test_LDADD): New vars, for eaccess.
2004-07-27(do_link): find_backup_file_name no longer returns NULL, so don'tPaul Eggert-4/+1
bother to check for this.
2004-07-27(do_copy): find_backup_file_name no longer returns NULL, so don'tPaul Eggert-3/+0
bother to check for this.
2004-07-27(copy_internal): find_backup_file_name no longerPaul Eggert-2/+0
returns NULL, so don't bother to check for this.
2004-07-26Regenerate.Paul Eggert-1/+1
2004-07-26(GET_NICE_VALUE): Renamed from GET_PRIORITY.Paul Eggert-50/+42
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.
2004-07-25Regenerate.Paul Eggert-1/+1
2004-07-25(R_OK, W_OK, X_OK, FOK): Remove; system.h defines them.Paul Eggert-50/+3
(eaccess): Remove. All users changed to use euidaccess instead.
2004-07-25pathchk.c: Include euidaccess.h.Paul Eggert-3/+3
(dir_ok): Use euidaccess, not access.
2004-07-24(print_uptime) [defined BOOT_MSG]:Paul Eggert-1/+1
Don't assume ut_line is null-terminated.
2004-07-24(print_line): New arguments USERLEN and LINELEN, since USER and LINEPaul Eggert-14/+17
might not be null terminated. All callers changed.
2004-07-23Regenerate.Paul Eggert-5/+5
2004-07-23Include fcntl-safer.h.Paul Eggert-133/+139
(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.
2004-07-22(main): Ignore -f if no file operand is specifiedPaul Eggert-0/+9
and standard input is a pipe.
2004-07-12Include c-strtod.h.Paul Eggert-10/+15
(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.
2004-07-12Regenerate.Paul Eggert-9/+56
2004-07-12(vstrtold): Renamed from vstrtod.Paul Eggert-5/+14
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.
2004-07-08.Jim Meyering-1/+1
2004-07-08printf cleanup, to avoid undefined behavior, to add support forJim Meyering-96/+172
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.
2004-07-06Change "readlink -f" to be more compatible with prior implementations.Jim Meyering-7/+33
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.
2004-07-04(copy_internal): Add a FIXME comment.Jim Meyering-1/+2
2004-07-04(main): Don't pass NULL first argument to path_concat.Jim Meyering-5/+10
This cleans up the semantics a bit, as we no longer try to open the same file twice.
2004-07-04(movefile): Assume path_concat returns non-NULL.Jim Meyering-2/+0
2004-07-04(do_copy): Assume path_concat returns non-NULL.Jim Meyering-3/+1
(make_path_private): 2nd arg is now size_t, not int, to avoid problem when path_concat dir name is longer than 2 GiB (!).
2004-07-04(copy_dir): Assume path_concat returns non-NULL.Jim Meyering-3/+0
2004-07-02Add short names -t and -T for --target-directoryJim Meyering-69/+52
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.
2004-07-02Add short names -t and -T for --target-directoryJim Meyering-16/+15
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.
2004-07-02.Jim Meyering-1/+1
2004-06-30Use "file system" rather than "filesystem" in comments.Jim Meyering-6/+6
2004-06-30.Jim Meyering-1/+1
2004-06-30(usage, main): Output "file system" rather than "filesystem".Jim Meyering-6/+7
(long_options, usage): Rename "--filesystem" to "--file-system". But keep the old name around, for compatibility reasons.
2004-06-30(usage, main): Output "file system" rather than "filesystem".Jim Meyering-49/+49
2004-06-30.Jim Meyering-1/+1
2004-06-30Add support for --no-target-directory option.Jim Meyering-2/+21
(NO_TARGET_DIRECTORY_OPTION): New constant. (long_options, usage, main): Add support for
2004-06-30Add support for --no-target-directory option.Jim Meyering-3/+22
(NO_TARGET_DIRECTORY_OPTION): New constant. (long_options, usage, main): Add support for (enum): Sort values.
2004-06-30Add support for --no-target-directory option.Jim Meyering-2/+26
(NO_TARGET_DIRECTORY_OPTION): New constant. (long_options, usage, main): Add support for
2004-06-30Add support for --no-target-directory option.Jim Meyering-3/+24
(NO_TARGET_DIRECTORY_OPTION): New constant. (long_opts, usage, do_copy, main): Add support for
2004-06-29Add support for 'install --target-directory', an optionJim Meyering-26/+74
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.
2004-06-28 Use more-consistent rules among cp, ln, and mv when dealing withJim Meyering-75/+63
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.
2004-06-28 Use more-consistent rules among cp, ln, and mv when dealing withJim Meyering-120/+89
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.
2004-06-28 Use more-consistent rules among cp, ln, and mv when dealing withJim Meyering-90/+65
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/cp.c (do_copy): Use it. * src/cp.c (do_copy): Don't assume argc is positive. Don't bother to lstat dest, since copy() will do that for us. Use "const" to avoid the need for cast. * 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/cp.c (do_copy): Remove test for trailing slash, since target_directory_operand now does this. * 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.
2004-06-28(usage): Fix copy+paste error in description ofJim Meyering-1/+1
--target-directory: s/move/copy/. From Paul Jarc.