summary refs log tree commit diff
diff options
context:
space:
mode:
authorJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2015-08-08 03:39:51 +0900
committerJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2015-08-08 03:39:51 +0900
commitd09dc4562a1bd72b923a730dbe837406e4f10ccb (patch)
tree3ac3f13e4fca3f2eded5d84c601e0da6ad03001a
parent2fc05d522fa2bf4cab0ebe57bee02093ba6b1382 (diff)
downloadzsh-d09dc4562a1bd72b923a730dbe837406e4f10ccb.tar.gz
zsh-d09dc4562a1bd72b923a730dbe837406e4f10ccb.tar.xz
zsh-d09dc4562a1bd72b923a730dbe837406e4f10ccb.zip
35928: '%-m' should work even if not supported by strftime(3)
Also clarify document.
-rw-r--r--ChangeLog6
-rw-r--r--Doc/Zsh/prompt.yo7
-rw-r--r--Src/utils.c2
3 files changed, 11 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 337a1f31f..45fc04732 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-08-08  Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+	* 35928: Src/utils.c, Doc/Zsh/prompt.yo: date/time format such
+	as '%-m' should work even if strftime(3) doesn't support it.
+	Also clarify document.
+
 2015-08-05  Mikael Magnusson  <mikachu@gmail.com>
 
 	* 35989: Completion/Unix/Command/_ssh: update to 6.9
diff --git a/Doc/Zsh/prompt.yo b/Doc/Zsh/prompt.yo
index c4e201465..3c8f2a094 100644
--- a/Doc/Zsh/prompt.yo
+++ b/Doc/Zsh/prompt.yo
@@ -206,9 +206,10 @@ The GNU extension that a `tt(-)' between the tt(%) and the
 format character causes a leading zero or space to be stripped
 is handled directly by the shell for the format characters tt(d), tt(f),
 tt(H), tt(k), tt(l), tt(m), tt(M), tt(S) and tt(y); any other format
-characters are provided to tt(strftime+LPAR()RPAR()) with any leading `tt(-)',
-present, so the handling is system dependent.  Further GNU
-extensions are not supported at present.
+characters are provided to the system's strftime+LPAR()3RPAR()
+with any leading `tt(-)' present, so the handling is system dependent.
+Further GNU (or other) extensions are also passed to strftime+LPAR()3RPAR()
+and may work if the system supports them.
 )
 enditem()
 
diff --git a/Src/utils.c b/Src/utils.c
index f7aaaedf4..236661a9f 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -3006,7 +3006,6 @@ morefmt:
 
 		*buf++ = '0' + (hr12 % 10);
 		break;
-#ifndef HAVE_STRFTIME
 	    case 'd':
 		if (tm->tm_mday > 9 || !strip)
 		    *buf++ = '0' + tm->tm_mday / 10;
@@ -3032,6 +3031,7 @@ morefmt:
 		    *buf++ = '0' + (tm->tm_year / 10) % 10;
 		*buf++ = '0' + tm->tm_year % 10;
 		break;
+#ifndef HAVE_STRFTIME
 	    case 'Y':
 	    {
 		int year, digits, testyear;