diff options
| author | erh <erh@NetBSD.org> | 2012-12-02 21:13:07 +0000 |
|---|---|---|
| committer | erh <erh@NetBSD.org> | 2012-12-02 21:13:07 +0000 |
| commit | 87de843d68509bdb6c8698c4f5d402e1d2afffd6 (patch) | |
| tree | e7382f6ee37e889c6176aeccb978056fdba55ae2 /usr.bin/stat/stat.c | |
| parent | 6f8b9b349bfaa27f555e1eb62d3c8b53b4cac32e (diff) | |
Honor the -t option to set the time format when running stat -s.
Document the format used by -s on the man page.
Diffstat (limited to 'usr.bin/stat/stat.c')
| -rw-r--r-- | usr.bin/stat/stat.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/stat/stat.c b/usr.bin/stat/stat.c index 2d3929bd0ef..842f5f88f5b 100644 --- a/usr.bin/stat/stat.c +++ b/usr.bin/stat/stat.c @@ -1,4 +1,4 @@ -/* $NetBSD: stat.c,v 1.36 2011/09/22 20:23:56 apb Exp $ */ +/* $NetBSD: stat.c,v 1.37 2012/12/02 21:13:07 erh Exp $ */ /* * Copyright (c) 2002-2011 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include <sys/cdefs.h> #if !defined(lint) -__RCSID("$NetBSD: stat.c,v 1.36 2011/09/22 20:23:56 apb Exp $"); +__RCSID("$NetBSD: stat.c,v 1.37 2012/12/02 21:13:07 erh Exp $"); #endif #if ! HAVE_NBTOOL_CONFIG_H @@ -76,7 +76,7 @@ __RCSID("$NetBSD: stat.c,v 1.36 2011/09/22 20:23:56 apb Exp $"); #if HAVE_STRUCT_STAT_ST_BIRTHTIME #define DEF_B "\"%SB\" " #define RAW_B "%B " -#define SHELL_B "st_birthtime=%B " +#define SHELL_B "st_birthtime=%SB " #else /* HAVE_STRUCT_STAT_ST_BIRTHTIME */ #define DEF_B #define RAW_B @@ -99,7 +99,7 @@ __RCSID("$NetBSD: stat.c,v 1.36 2011/09/22 20:23:56 apb Exp $"); #define SHELL_FORMAT \ "st_dev=%d st_ino=%i st_mode=%#p st_nlink=%l " \ "st_uid=%u st_gid=%g st_rdev=%r st_size=%z " \ - "st_atime=%a st_mtime=%m st_ctime=%c " SHELL_B \ + "st_atime=%Sa st_mtime=%Sm st_ctime=%Sc " SHELL_B \ "st_blksize=%k st_blocks=%b" SHELL_F #define LINUX_FORMAT \ " File: \"%N\"%n" \ @@ -299,6 +299,8 @@ main(int argc, char *argv[]) break; case 's': statfmt = SHELL_FORMAT; + if (timefmt == NULL) + timefmt = "%s"; break; case 'x': statfmt = LINUX_FORMAT; |
