Age | Commit message (Collapse) | Author |
|
arrived nearly simultaneously.
(main): Rewrite signal-catching code to make it
similar to other coreutils programs. When processing signals,
block all signals that we catch, but do not block signals that we
don't catch. Avoid problems with unsigned int warnings.
(sighandler) [defined SA_NOCLDSTOP]:
Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
(sighandler) [!defined SA_NOCLDSTOP]: Reset signal
handler to self, not to SIG_IGN, since SIGTSTP can be received more than once.
(main): Use SA_RESTART, as that is simpler than checking for EINTR
failures all over the place.
|
|
|
|
(main): Don't assume EXIT_FAILURE == 1, as POSIX doesn't require it.
|
|
Remove forward decl; not needed.
(print_file_name_and_frills, length_of_file_name_and_frills):
With -m, don't output spaces before inum or size.
(print_with_commas): Don't output space just before newline.
|
|
`dired_pos += width; dired_pos++;' rather than one,
`dired_pos += width + 1;' since the latter could conceivably overflow.
(format_group): Likewise.
|
|
(format_user_width, format_group_width, unsigned_file_size,
format_group): New functions.
(block_size_width): Renamed from block_size_size.
(inode_number_width, nlink_width, owner_width, group_width,
author_width, major_device_number_width, minor_device_number_width,
file_size_width): New vars.
(clear_files): Initialize them.
(gobble_file): Set them. Don't ceiling block_size_width to 7.
(print_long_file): Use them.
(gobble_file): Use a new local variable 'f' to make the code
smaller and more consistent with other functions.
(format_user): Output to stdout, not to a buffer, so that we
don't have to worry about buffer overrun. Update dired_pos.
(print_long_file): Don't put owner, group, author into buffer;
just print them directly. Don't assume link counts and
major and minor numbers fit into unsigned long int.
From Paul Eggert.
|
|
This avoids a warning valgrind about memcpy with overlapping
source and destination.
|
|
type changes (unsigned int -> size_t) in hash.c.
|
|
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.
* src/true.c (main): Append NULL to version_etc argument list.
* src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
|
|
warning-inducing test, ws.ws_col <= SIZE_MAX, since it was always
true on Linux.
|
|
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.
|
|
|
|
nfiles, files_index, tabsize, line_length, struct column_info.line_len,
struct column_info.col_arr[0], max_idx):
Now size_t, not int.
(get_funky_string): Return bool indicating success, instead of
a negative count to indicate failure. Store number of columns
through new parameter OUTPUT_COUNT; that way, they can never
go negative. Change equals_end from int to bool. All uses
changed.
(struct column_info.valid_len): Now bool, not int. All uses changed.
(dired_dump_obstack, get_funky_string, clear_files,
extract_dirs_from_files, print_current_files,
print_many_per_line, print_horizontal, init_column_info,
put_indicator, length_of_file_name_and_frills,
print_with_commas): Use size_t, not int, for local variables
that count sizes.
(decode_switches): Decode sizes using xstrtoul, not xstrtol.
Check for TIOCGWINSZ returing negative values (or values greater
than SIZE_MAX!).
(visit_dir, main, parse_ls_color, queue_directory, add_ignore_pattern,
init_column_info):
Use xmalloc and xnmalloc, not XMALLOC.
(gobble_file): Use xnrealloc, not XREALLOC.
(print_color_indicator): Remove now-unnecessary cast to size_t.
|
|
|
|
|
|
Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
Mark each WRITTEN_BY string as translatable.
|
|
|
|
the call to parse_long_options so that `AUTHORS, NULL' are the last parameters.
|
|
|
|
clobbered by a `longjmp' into this function.
|
|
Don't include stdlib.h.
|
|
adequate, since join.c uses alloca, yet lacked an in-file #pragma.
Remove `#pragma alloca'.
|
|
|
|
in e.g. 1,000,000 and 1,048,576. Instead, do this:
`SIZE may be ..., MB 1000*1000, M 1024*1024 and so on...'
|
|
|
|
|
|
store the screen columns, and return the number of bytes instead.
(print_dir): Pass NULL as fourth parameter of quote_name.
(print_name_with_quoting): Likewise.
(length_of_file_name_and_frills): Get the width from the fourth
parameter of quote_name instead of return value.
|
|
`format == long_format', then silently reset dired. This doesn't
change the behavior of ls (all prior uses of dired were protected
by `&& format == long_format'), and lets us...
(DIRED_INDENT): ... remove `format == long_format' conjunct.
(PUSH_CURRENT_DIRED_POS): Likewise.
(main): Likewise.
|
|
(enum) [DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION]: New member.
(long_options): Add option --dereference-command-line-symlink-to-dir.
(main): Make DEREF_COMMAND_LINE_SYMLINK_TO_DIR be the default,
rather than DEREF_COMMAND_LINE_ARGUMENTS, when none of the
-d, -F, -l options is specified.
(decode_switches): Handle --dereference-command-line-symlink-to-dir.
(gobble_file): Honor DEREF_COMMAND_LINE_SYMLINK_TO_DIR.
Change --dereference-command-line (-H) to dereference *all*
command line arguments, including broken symlinks.
|
|
compatible with FreeBSD and the POSIX spec is confusing
and somewhat contradictory.
(DEREF_COMMAND_LINE_ARGUMENTS): Change name back
from DEREF_COMMAND_LINE_SYMLINK_TO_DIR, updating all uses.
(long_options): Change the long option name back.
(usage): Change the usage back.
(gobble_file): When -H is specified, dereference a top-level
arg even if it points to a non-directory.
|
|
when --dereference (-L) is not specified, and
- when operating on a dangling symlink
- when operating on command-line-symlink-to-directories
This fixes numerous problems. Here are examples:
- `ls dangling-symlink' would fail with `no such file...'
Now it prints `dangling-symlink'.
- `ls -i symlink' would mistakenly print the inode of the referent.
Now it prints the inode of the symlink. Likewise for --size (-s).
Based on a patch from Michael Stone.
Reported by Deepak Goel as Debian bug #173793.
|
|
option to --dereference-command-line-symlink-to-dir.
[enum Dereference_symlink]
(DEREF_COMMAND_LINE_SYMLINK_TO_DIR): Rename from
DEREF_COMMAND_LINE_ARGUMENTS. Update all uses.
(long_options): Rename the option.
(usage): Say that --dereference-... changes how ls treats
only symlinks to directories specified on the command line.
|
|
so that ls --color would no longer highlight the names of files with
the execute bit set when not specified on the command line.
Patch by Michael Stone. Reported by Stephen Depooter as
Debian bug 175135.
|
|
[struct dev_ino]: Remove declaration.
|
|
|
|
Include strftime.h instead.
|
|
regular file and --indicator-style=classify (aka -F).
|
|
entry on systems with valid dirent.d_type.
(print_dir): Add DT_LNK and DT_REG.
(main): Make --recursive set format_needs_type, not format_needs_stat.
(gobble_file): Remove a FIXME comment, now that this is fixed.
|
|
`ls --color -F symlink-to-dir' to list the files in
`symlink-to-dir/.'. Now, it prints `symlink-to-dir@',
(just like `ls -F symlink-to-dir') but with the addition
of highlighting.
|
|
decode the QUOTING_STYLE environment variable. This is more
consistent with the documentation, and with --quoting-style.
|
|
Replace sole use with equivalent `#ifdef S_ISLNK'.
Inconsistency reported by Dmitry V. Levin.
|
|
Based on suggestions from Solar Designer and Dmitry V. Levin.
Add comments.
|
|
(sighandler): New function, based on the one in sort.c.
(main): Use sigaction, if possible; otherwise signal.
Handle these signals:
SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, SIGTSTP.
Don't register our handler if the signal is already being ignored.
|
|
|
|
Include "full-write.h" and <signal.h>.
(restore_default_color, restore_default_color_handler): New functions.
(sigtstp_handler, put_indicator_direct): New functions.
(main) [print_with_color]: Register signal handlers.
Patch mostly by Solar Designer and Stanislav Ievlev.
|
|
Use primitives from inttostr.h, not
human.h, to print large numbers simply.
(human_output_opts): New var.
(output_block_size): Now uintmax_t, not int, to handle larger
block sizes. All uses changed.
(file_output_block_size): New var, to distinguish
file sizes from other sizes.
(decode_switches): Set it.
|
|
since it's already included from sys2.h via system.h.
|
|
On some systems (at least EMC Celerra and Solaris5.8),
this appears to be necessary.
(print_dir): Rename local variable: reading -> dirp.
|
|
|
|
Add long_iso_time_style.
(time_style_args, time_style_types, decode_switches): Likewise.
(decode_switches): If a time style is prefixed by "posix-", ignore
it if in the POSIX locale. Default style is now posix-long-iso.
(usage): Explain the above.
|