diff options
Diffstat (limited to 'Src/prompt.c')
-rw-r--r-- | Src/prompt.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Src/prompt.c b/Src/prompt.c index ac96ad340..dc31eddb6 100644 --- a/Src/prompt.c +++ b/Src/prompt.c @@ -500,18 +500,23 @@ putpromptchar(int doprint, int endchar) tmfmt = "%m/%d/%y"; break; case 'D': - if (fm[1] == '{') /*}*/ { + if (fm[1] == '{' /*}*/) { for (ss = fm + 2; *ss && *ss != /*{*/ '}'; ss++) if(*ss == '\\' && ss[1]) ss++; dd = tmfmt = tmbuf = zalloc(ss - fm); - for (ss = fm + 2; *ss && *ss != /*{*/ '}'; ss++) { + for (ss = fm + 2; *ss && *ss != /*{*/ '}'; + ss++) { if(*ss == '\\' && ss[1]) ss++; *dd++ = *ss; } *dd = 0; fm = ss - !*ss; + if (!*tmfmt) { + free(tmbuf); + continue; + } } else tmfmt = "%y-%m-%d"; break; @@ -523,7 +528,7 @@ putpromptchar(int doprint, int endchar) tm = localtime(&timet); for(t0=80; ; t0*=2) { addbufspc(t0); - if(ztrftime(bp, t0, tmfmt, tm) != t0) + if (ztrftime(bp, t0, tmfmt, tm)) break; } bp += strlen(bp); |