summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2018-11-01 21:46:50 -0400
committerTavian Barnes <tavianator@tavianator.com>2018-11-01 21:46:50 -0400
commit8c3b9aaaab11be9d0fe24a72ebb16e171ca22125 (patch)
tree1eceebe2763cec5a010a193d48b50edef5fb78a2 /eval.c
parentb74261ac825ec2b9c02d73e36f7b44b64c9d184c (diff)
downloadbfs-8c3b9aaaab11be9d0fe24a72ebb16e171ca22125.tar.xz
Print device major/minor numbers for -ls
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/eval.c b/eval.c
index 15dddf4..b3d85f2 100644
--- a/eval.c
+++ b/eval.c
@@ -658,9 +658,17 @@ bool eval_fls(const struct expr *expr, struct eval_state *state) {
}
}
- uintmax_t size = statbuf->size;
- if (fprintf(file, " %8ju", size) < 0) {
- goto error;
+ if (ftwbuf->typeflag & (BFTW_BLK | BFTW_CHR)) {
+ int ma = bfs_major(statbuf->rdev);
+ int mi = bfs_minor(statbuf->rdev);
+ if (fprintf(file, " %3d, %3d", ma, mi) < 0) {
+ goto error;
+ }
+ } else {
+ uintmax_t size = statbuf->size;
+ if (fprintf(file, " %8ju", size) < 0) {
+ goto error;
+ }
}
time_t time = statbuf->mtime.tv_sec;