aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2019-09-14 23:01:00 -0500
committerRob Landley <rob@landley.net>2019-09-14 23:01:00 -0500
commitc03a070f20cac4d38ac5f72534204522db63a04b (patch)
treed3a3b270107cb8a613e0cccc0e54ffad9d0f9deb /toys/posix
parent38509d0e217d57d9b7fb18727bd02277cd205566 (diff)
downloadtoybox-c03a070f20cac4d38ac5f72534204522db63a04b.tar.gz
Add -newerXY
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/file.c9
1 files changed, 6 insertions, 3 deletions
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)) {