Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/stat Set the default time format for linux mode (-x)...



details:   https://anonhg.NetBSD.org/src/rev/4d4382af5de7
branches:  trunk
changeset: 826653:4d4382af5de7
user:      kre <kre%NetBSD.org@localhost>
date:      Wed Sep 20 17:45:25 2017 +0000

description:
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.

diffstat:

 usr.bin/stat/stat.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (35 lines):

diff -r ecaa343d8ed0 -r 4d4382af5de7 usr.bin/stat/stat.c
--- a/usr.bin/stat/stat.c       Wed Sep 20 09:36:20 2017 +0000
+++ b/usr.bin/stat/stat.c       Wed Sep 20 17:45:25 2017 +0000
@@ -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 @@
                                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 @@
        case 'x':
                statfmt = LINUX_FORMAT;
                if (timefmt == NULL)
-                       timefmt = "%c";
+                       timefmt = "%Y-%m-%d %H:%M:%S.%f %z";
                break;
        default:
                usage(synopsis);



Home | Main Index | Thread Index | Old Index