Module Name:    src
Committed By:   kre
Date:           Wed Sep 20 17:45:25 UTC 2017

Modified Files:
        src/usr.bin/stat: stat.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/usr.bin/stat/stat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/stat/stat.c
diff -u src/usr.bin/stat/stat.c:1.40 src/usr.bin/stat/stat.c:1.41
--- src/usr.bin/stat/stat.c:1.40	Wed Sep 20 01:23:37 2017
+++ src/usr.bin/stat/stat.c	Wed Sep 20 17:45:25 2017
@@ -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);

Reply via email to