From 9f8d62ab644553b11286dbcd283db56c83d6ebdd Mon Sep 17 00:00:00 2001 From: Ori Bernstein Date: Tue, 22 Sep 2020 19:24:01 -0700 Subject: libc: ignore '?' in date format strings Ignoring '?' when formatting date strings allows the format strings to be reused for parsing. This is convenient, since we don't need to duplicate the format strings. --- sys/src/libc/port/date.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sys/src/libc') diff --git a/sys/src/libc/port/date.c b/sys/src/libc/port/date.c index 1c90a7985..7be6cb52f 100644 --- a/sys/src/libc/port/date.c +++ b/sys/src/libc/port/date.c @@ -428,6 +428,9 @@ static int switch(c0){ case 0: break; + /* Ignore '?' so we can share parse and format strings */ + case '?': + continue; case 'Y': switch(w){ case 1: n += fmtprint(f, "%*d", pad, tm->year + 1900); break; -- cgit v1.2.3