diff options
author | Ori Bernstein <ori@eigenstate.org> | 2020-09-22 19:24:01 -0700 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2020-09-22 19:24:01 -0700 |
commit | 9f8d62ab644553b11286dbcd283db56c83d6ebdd (patch) | |
tree | 5913f9e51391674e51786f74ae962eee63543fee /sys/src/libc | |
parent | 77c3cb50fb529740c57908cc5f0655fba0257c91 (diff) |
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.
Diffstat (limited to 'sys/src/libc')
-rw-r--r-- | sys/src/libc/port/date.c | 3 |
1 files changed, 3 insertions, 0 deletions
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; |