From c03a070f20cac4d38ac5f72534204522db63a04b Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 14 Sep 2019 23:01:00 -0500 Subject: Add -newerXY --- toys/posix/file.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'toys/posix') diff --git a/toys/posix/file.c b/toys/posix/file.c index d1e425bd..17bc45f7 100644 --- a/toys/posix/file.c +++ b/toys/posix/file.c @@ -4,18 +4,20 @@ * * See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/file.html -USE_FILE(NEWTOY(file, "<1hL[!hL]", TOYFLAG_USR|TOYFLAG_BIN)) +USE_FILE(NEWTOY(file, "<1bhLs[!hL]", TOYFLAG_USR|TOYFLAG_BIN)) config FILE bool "file" default y help - usage: file [-hL] [file...] + usage: file [-bhL] [file...] Examine the given files and describe their content types. + -b Brief (no filename) -h Don't follow symlinks (default) -L Follow symlinks + -s show block/char device contents */ #define FOR_file @@ -449,7 +451,8 @@ void file_main(void) struct stat sb; int fd = !strcmp(name, "-"); - xprintf("%s: %*s", name, (int)(TT.max_name_len - strlen(name)), ""); + if (!FLAG(b)) + xprintf("%s: %*s", name, (int)(TT.max_name_len - strlen(name)), ""); sb.st_size = 0; if (fd || !((toys.optflags & FLAG_L) ? stat : lstat)(name, &sb)) { -- cgit v1.2.3