aboutsummaryrefslogtreecommitdiff
path: root/coreutils/ls.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2019-02-16 12:36:52 +0000
committerRon Yorston <rmy@pobox.com>2019-02-16 12:36:52 +0000
commitd82db8e9a618ddd9a11cc57aff37f687abb0effb (patch)
treebd072e7344a3c3f0eff553d41c0f154c4470736e /coreutils/ls.c
parent91e49fbc7b55e8be78ac3ff943e9b7d4494dfe59 (diff)
downloadbusybox-w32-d82db8e9a618ddd9a11cc57aff37f687abb0effb.tar.gz
busybox-w32-d82db8e9a618ddd9a11cc57aff37f687abb0effb.tar.bz2
busybox-w32-d82db8e9a618ddd9a11cc57aff37f687abb0effb.zip
win32: make stat(2) fetch additional metadata
Modify the WIN32 implementation of stat(2) to fetch inode number, device id and number of hardlinks. This requires opening a handle to the target file so it will be slower. A number of features can be enabled or start to work: - tar can detect if an archive is being stored in itself; - find can support the -inum and -links options; - ls can display inode numbers; - diff can detect attempts to compare a file with itself; - du has better support for hardlinked files; - cp can detect attempts to copy a file over itself.
Diffstat (limited to 'coreutils/ls.c')
-rw-r--r--coreutils/ls.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 48927c964..a1782ed45 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -499,7 +499,11 @@ static NOINLINE unsigned display_single(const struct dnode *dn)
499#endif 499#endif
500 500
501 if (opt & OPT_i) /* show inode# */ 501 if (opt & OPT_i) /* show inode# */
502#if !ENABLE_FEATURE_EXTRA_FILE_DATA
502 column += printf("%7"LL_FMT"u ", (long long) dn->dn_ino); 503 column += printf("%7"LL_FMT"u ", (long long) dn->dn_ino);
504#else
505 column += printf("%19"LL_FMT"u ", (long long) dn->dn_ino);
506#endif
503//TODO: -h should affect -s too: 507//TODO: -h should affect -s too:
504 if (opt & OPT_s) /* show allocated blocks */ 508 if (opt & OPT_s) /* show allocated blocks */
505 column += printf("%6"OFF_FMT"u ", (off_t) (dn->dn_blocks >> 1)); 509 column += printf("%6"OFF_FMT"u ", (off_t) (dn->dn_blocks >> 1));