<feed xmlns='http://www.w3.org/2005/Atom'>
<title>coreutils/src/ls.c, branch v9.0</title>
<subtitle>Mirror of https://https.git.savannah.gnu.org/git/coreutils.git/
</subtitle>
<id>https://git.shady.money/coreutils/atom?h=v9.0</id>
<link rel='self' href='https://git.shady.money/coreutils/atom?h=v9.0'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/'/>
<updated>2021-07-28T22:16:50Z</updated>
<entry>
<title>maint: avoid syntax-check failures in recent ls changes</title>
<updated>2021-07-28T22:16:50Z</updated>
<author>
<name>Pádraig Brady</name>
<email>P@draigBrady.com</email>
</author>
<published>2021-07-28T22:16:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=eca33373ce9bab460f06ab037746a8d71cf34ec6'/>
<id>urn:sha1:eca33373ce9bab460f06ab037746a8d71cf34ec6</id>
<content type='text'>
* src/ls.c: Fix ifdef indenting and long line.
</content>
</entry>
<entry>
<title>doc: modernize usage of “disk” and “core”</title>
<updated>2021-07-28T19:30:12Z</updated>
<author>
<name>Paul Eggert</name>
<email>eggert@cs.ucla.edu</email>
</author>
<published>2021-07-28T19:22:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=d60b2922ffb30d15e81b0019025b8e62af070a6e'/>
<id>urn:sha1:d60b2922ffb30d15e81b0019025b8e62af070a6e</id>
<content type='text'>
In documentation and comments, don’t assume that secondary storage
devices are disk devices.  Similarly, don’t assume that main memory
uses magnetic cores, which became obsolete in the 1970s.
* src/du.c (usage):
* src/ls.c (usage):
* src/shred.c (usage): Reword to avoid “disk” in usage messages.
</content>
</entry>
<entry>
<title>doc: improve ls documentation</title>
<updated>2021-07-28T19:30:12Z</updated>
<author>
<name>Paul Eggert</name>
<email>eggert@cs.ucla.edu</email>
</author>
<published>2021-07-28T18:26:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=1625916a1ba4148b4127b7742337bde1606d4b80'/>
<id>urn:sha1:1625916a1ba4148b4127b7742337bde1606d4b80</id>
<content type='text'>
* doc/coreutils.texi (ls invocation): Document implementation more
closely.  Be more consistent about style.  Omit some needless words.
* src/ls.c (usage): Don’t overdocument -f, as the details were wrong.
Omit -1 advice as it’s a bit obsolete now that we have --zero and
is a bit much for --usage output anyway.
</content>
</entry>
<entry>
<title>ls: rename --null to --zero (Bug#49716)</title>
<updated>2021-07-28T01:08:39Z</updated>
<author>
<name>Paul Eggert</name>
<email>eggert@cs.ucla.edu</email>
</author>
<published>2021-07-28T00:34:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=c75779cac3abec6e6072c0ac77dced85d1c44370'/>
<id>urn:sha1:c75779cac3abec6e6072c0ac77dced85d1c44370</id>
<content type='text'>
* NEWS, doc/coreutils.texi (General output formatting):
* src/ls.c (usage):
Document this.
* src/ls.c (ZERO_OPTION): Rename from NULL_OPTION.
All uses changed.
(long_options): Rename --null to --zero.
(dired_dump_obstack, main, print_dir): Use '\n' instead of
eolbyte where eolbyte must equal '\n'.
(decode_switches): Decode --zero instead of --null.
--zero also implies -1, -N, --color=none, --show-control-chars.
Use easier-to-decipher code to set ‘format’ and ‘dired’.
Reject attempts to combine --dired and --zero.
* tests/local.mk: Adjust to test script renaming.
* tests/ls/zero-option.sh: Rename from tests/ls/null-option.sh,
and test --zero instead of --null.
</content>
</entry>
<entry>
<title>ls: compute defaults more lazily</title>
<updated>2021-07-28T01:08:38Z</updated>
<author>
<name>Paul Eggert</name>
<email>eggert@cs.ucla.edu</email>
</author>
<published>2021-07-27T21:27:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=9e4a6101f239b8168144078edd04843dea4dc69f'/>
<id>urn:sha1:9e4a6101f239b8168144078edd04843dea4dc69f</id>
<content type='text'>
* src/ls.c (enum time_type, enum sort_type, enum indicator_style)
(enum Dereference_symlink, ignore_mode):
Put ‘= 0’ after default values, since the code relies
on static storage defaulting to zero.
(enum sort_type): Reorder so that -1 can be used to represent unset.
(main): Test print_with_color after parse_ls_color may have reset it.
(decode_line_length): Return the line length instead of setting
static storage.  All uses changed.  Treat line lengths exceeding
PTRDIFF_MAX as infinite, to avoid pointer-subtraction glitches.
(stdout_isatty): New function, to avoid calling isatty twice.
(decode_switches): Calculate defaults more lazily, to avoid using
syscalls or getenv during startup unless the results are more
likely to be needed.  Use -1 to indicate options that haven’t been
set on the command line yet.  Move print_with_color test from
here to ‘main’.  Suppress bogus GCC warning.
(getenv_quoting_style): Return the quoting style instead of
setting static storage.
(init_column_info): New arg MAX_COLS, to avoid recalculating it.
Caller changed.
</content>
</entry>
<entry>
<title>ls: add --null option (Bug#49716)</title>
<updated>2021-07-26T07:59:37Z</updated>
<author>
<name>Paul Eggert</name>
<email>eggert@cs.ucla.edu</email>
</author>
<published>2021-07-26T04:24:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=7d44ac224c93940d1a708442c1edf1a927be7057'/>
<id>urn:sha1:7d44ac224c93940d1a708442c1edf1a927be7057</id>
<content type='text'>
* NEWS, doc/coreutils.texi (General output formatting):
* src/ls.c (usage): Document this.
* src/ls.c (NULL_OPTION): New constant.
(long_options): Add --null.
(eolbyte): New static var.
(dired_dump_obstack, main, print_dir, print_current_files)
(print_many_per_line, print_horizontal, print_with_separator):
Output eolbyte instead of '\n'.
(decode_switches): Decode --null.
* tests/ls/null-option.sh: New file.
* tests/local.mk (all_tests): Add it.
</content>
</entry>
<entry>
<title>ls: port to wider off_t, uid_t, gid_t</title>
<updated>2021-07-26T07:59:37Z</updated>
<author>
<name>Paul Eggert</name>
<email>eggert@cs.ucla.edu</email>
</author>
<published>2021-07-26T07:26:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=39673b6d4cffe6315d2a572c3741777b3f6a3d28'/>
<id>urn:sha1:39673b6d4cffe6315d2a572c3741777b3f6a3d28</id>
<content type='text'>
* src/ls.c (dired_pos): Now off_t, not size_t, since it counts
output file offsets.
(dired_dump_obstack): This obstack's file offsets are now
off_t, not size_t.
(format_user_or_group, format_user_or_group_width):
ID arg is now uintmax_t, not unsigned long, since uid_t and
gid_t values might exceed ULONG_MAX.
(format_user_or_group_width): Use snprintf with NULL instead of
sprintf with a discarded buffer.  This avoids a stack buffer,
and so should be safer.
</content>
</entry>
<entry>
<title>ls: demacroize</title>
<updated>2021-07-26T07:59:37Z</updated>
<author>
<name>Paul Eggert</name>
<email>eggert@cs.ucla.edu</email>
</author>
<published>2021-07-26T04:01:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=0a41ad2cfb6aa7af21f40fc870a0b917410b1d4b'/>
<id>urn:sha1:0a41ad2cfb6aa7af21f40fc870a0b917410b1d4b</id>
<content type='text'>
Prefer functions or constants to macros where either will do.
That’s cleaner, and nowadays there’s no performance reason to
prefer macros.  All uses changed.
* src/ls.c (INITIAL_TABLE_SIZE, MIN_COLUMN_WIDTH):
Now constants instead of macros.
(file_or_link_mode): New function, replacing the old macro
FILE_OR_LINK_MODE.
(dired_outbyte): New function, replacing the old macro DIRED_PUTCHAR.
(dired_outbuf): New function, replacing the old macro DIRED_FPUTS.
(dired_outstring): New function, replacing the old macro
DIRED_FPUTS_LITERAL.
(dired_indent): New function, replacing the old macro DIRED_INDENT.
(push_current_dired_pos): New function, replacing the old macro
PUSH_CURRENT_DIRED_POS.
(assert_matching_dev_ino): New function, replacing the old macro
ASSERT_MATCHING_DEV_INO.
(do_stat, do_lstat, stat_for_mode, stat_for_ino, fstat_for_ino)
(signal_init, signal_restore, cmp_ctime, cmp_mtime, cmp_atime)
(cmp_btime, cmp_size, cmp_name, cmp_extension)
(fileinfo_name_width, cmp_width, cmp_version):
No longer inline; compilers can deduce this well enough nowadays.
(main): Protect unused assert with ‘if (false)’ rather than
commenting it out, so that the compiler checks the code.
(print_dir): Output the space and newline in the same buffer
as the human-readable number they surround.
(dirfirst_check): New function, replacing the old macro
DIRFIRST_CHECK.  Simplify by using subtraction.
(off_cmp): New function, replacing the old macro longdiff.
(print_long_format): No need to null-terminate the string now.
(format_user_or_group): Let printf count the bytes.
</content>
</entry>
<entry>
<title>ls: simplify sprintf usage</title>
<updated>2021-07-26T07:59:36Z</updated>
<author>
<name>Paul Eggert</name>
<email>eggert@cs.ucla.edu</email>
</author>
<published>2021-07-26T01:54:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=c09b25dd3f83f2db6d6dde57146b2ba747073308'/>
<id>urn:sha1:c09b25dd3f83f2db6d6dde57146b2ba747073308</id>
<content type='text'>
* src/ls.c (format_user_or_group_width, print_long_format):
Use return value from sprintf instead of calling strlen on
the resulting buffer, or inferring the length some other way.
</content>
</entry>
<entry>
<title>maint: while (1) → while (true)</title>
<updated>2021-06-27T01:40:26Z</updated>
<author>
<name>Paul Eggert</name>
<email>eggert@cs.ucla.edu</email>
</author>
<published>2021-06-27T01:23:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=53bb0235d5fdcf6b5e0243b53b1713eb2f5474bc'/>
<id>urn:sha1:53bb0235d5fdcf6b5e0243b53b1713eb2f5474bc</id>
<content type='text'>
</content>
</entry>
</feed>
