summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkre <kre@NetBSD.org>2017-09-20 17:45:25 +0000
committerkre <kre@NetBSD.org>2017-09-20 17:45:25 +0000
commit2aef0a5cf2dee099889078617abc960ea6dce7ae (patch)
tree2cd5a5e15d4b648e6646f5d946883f673c793084
parent8468c8e946879ccc2ccfafd6a323a64a575c0c1f (diff)
Set the default time format for linux mode (-x) in the correct place,
so it only applies to -x (in particular, not to -s) and only if another time format has not been explicitly selected (earlier in the arg list). With luck, this will make lots of tests, which depended upon "stat -s" actually generating correct sh assignment statements, go back to working again.
-rw-r--r--usr.bin/stat/stat.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.bin/stat/stat.c b/usr.bin/stat/stat.c
index f78645f7f6b..a211728fe43 100644
--- a/usr.bin/stat/stat.c
+++ b/usr.bin/stat/stat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: stat.c,v 1.40 2017/09/20 01:23:37 christos Exp $ */
+/* $NetBSD: stat.c,v 1.41 2017/09/20 17:45:25 kre Exp $ */
/*
* Copyright (c) 2002-2011 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
-__RCSID("$NetBSD: stat.c,v 1.40 2017/09/20 01:23:37 christos Exp $");
+__RCSID("$NetBSD: stat.c,v 1.41 2017/09/20 17:45:25 kre Exp $");
#endif
#if ! HAVE_NBTOOL_CONFIG_H
@@ -265,7 +265,6 @@ main(int argc, char *argv[])
errx(1, "can't use format '%c' with '%c'",
fmtchar, ch);
fmtchar = ch;
- timefmt = "%Y-%m-%d %H:%M:%S.%f %z";
break;
case 't':
timefmt = optarg;
@@ -311,7 +310,7 @@ main(int argc, char *argv[])
case 'x':
statfmt = LINUX_FORMAT;
if (timefmt == NULL)
- timefmt = "%c";
+ timefmt = "%Y-%m-%d %H:%M:%S.%f %z";
break;
default:
usage(synopsis);