Jim Meyering [Sun, 19 Oct 2003 18:54:10 +0000 (18:54 +0000)]
chmod now uses fts to perform a directory traversal when -R is
specified. Before, it operated on full path names, and as such
would encounter the PATH_MAX (often 4096) limit.
Include "xfts.h".
(process_file): Rename from change_file_mode.
Adapt to be used with fts.
(process_files): New function.
Jim Meyering [Sat, 18 Oct 2003 10:05:47 +0000 (10:05 +0000)]
Most .c files (AUTHORS): Revert the WRITTEN_BY/AUTHORS change
of 2003-09-19. Now, AUTHORS is a comma-separated list of strings.
Update the call to parse_long_options so that `AUTHORS, NULL' are the
last parameters.
Jim Meyering [Sat, 18 Oct 2003 08:10:55 +0000 (08:10 +0000)]
Include stdarg.h, stdlib.h.
(version_etc_copyright): Declare as readonly.
(version_etc_va): New function. Provide a different translatable string
for each possible number of authors < 10. Abbreviate when there are 10
authors or more.
(version_etc): Make this function variadic. Call version_etc_va.
Jim Meyering [Sat, 18 Oct 2003 08:10:31 +0000 (08:10 +0000)]
Include stdarg.h.
(version_etc_copyright): Declare as readonly.
(version_etc): Make this function variadic with a NULL-terminated list
of author name strings.
(version_etc_va): New declaration.
Jim Meyering [Wed, 15 Oct 2003 21:21:29 +0000 (21:21 +0000)]
Include "fts_.h".
(WRITTEN_BY): Add my name.
(MAXUID, MAXGID): Remove definitions. Use GID_T_MAX instead of
the latter.
(usage): Update.
(main): Handle new options.
Call new function, chown_files rather than change_file_owner.
Jim Meyering [Wed, 15 Oct 2003 21:16:46 +0000 (21:16 +0000)]
chown now accepts POSIX-mandated -H, -L, -P options and uses
fts to perform a directory traversal when -R is specified.
Before, it used explicit recursion, and as such was limited by
the user's stack size to handling hierarchies no deeper than
about 30,000 levels.
Include "userspec.h" and "fts_.h".
(WRITTEN_BY): Add my name.
(getpwnam, getgrnam, getgrgid): Remove declarations.
(endpwent): Remove definition.
(usage): Update
(main): Handle new options.
Call new function, chown_files rather than change_file_owner.
Jim Meyering [Wed, 15 Oct 2003 13:57:21 +0000 (13:57 +0000)]
[enum Dereference_symlink]: Remove declaration.
[struct Chown_option] (recurse, force_silent): Change type to `bool'.
[struct Chown_option] (dereference): Remove member with ambiguous name.
[struct Chown_option] (affect_symlink_referent): New member.
(chown_files): New prototype.
Jim Meyering [Tue, 14 Oct 2003 09:09:43 +0000 (09:09 +0000)]
Fix to avoid a denial-of-service attack if the display width is
enormous. Also, clean up the code a bit by removing duplicate code.
(init_column_info): Remove forward decl; no longer needed.
(calculate_columns): New function, that contains code that used
to be common to print_many_per_line and print_horizontal.
(print_many_per_line, print_horizontal): Use it.
(decode_switches): Set max_idx here, not in calculate_columns.
(print_current_files): Don't call init_column_info; calculate_columns
now does that.
(init_column_info): Don't allocate a lot more space than is needed
to represent the current set of files. Allocate all the new
size_t cells in one call to xnmalloc, rather than a row at a time.