From 740972dc7234768787e3f49573c3ef08237476d8 Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Thu, 8 Feb 2001 20:55:38 +0000 Subject: [PATCH] Hardcode c_fmt in a different way since used in nl_langinfo now --- lib/libc/stdtime/strftime.c | 4 ++-- lib/libc/stdtime/strptime.c | 4 ++-- lib/libc/stdtime/timelocal.c | 5 +++-- lib/libc/stdtime/timelocal.h | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/libc/stdtime/strftime.c b/lib/libc/stdtime/strftime.c index 27b0170a0ad4..2712d95ed276 100644 --- a/lib/libc/stdtime/strftime.c +++ b/lib/libc/stdtime/strftime.c @@ -123,8 +123,8 @@ _fmt(format, t, pt, ptlim) "%02d", pt, ptlim); continue; case 'c': - /* NOTE: c_fmt is intentionally ignored */ - pt = _fmt("%a %Ef %T %Y", t, pt, ptlim); + /* NOTE: c_fmt is hardcoded in timelocal.c */ + pt = _fmt(tptr->c_fmt, t, pt, ptlim); continue; case 'D': pt = _fmt("%m/%d/%y", t, pt, ptlim); diff --git a/lib/libc/stdtime/strptime.c b/lib/libc/stdtime/strptime.c index 7da0b9c8c018..ee32651927f6 100644 --- a/lib/libc/stdtime/strptime.c +++ b/lib/libc/stdtime/strptime.c @@ -141,8 +141,8 @@ _strptime(const char *buf, const char *fmt, struct tm *tm) break; case 'c': - /* NOTE: c_fmt is intentionally ignored */ - buf = _strptime(buf, "%a %Ef %T %Y", tm); + /* NOTE: c_fmt is hardcoded in timelocal.c */ + buf = _strptime(buf, tptr->c_fmt, tm); if (buf == 0) return 0; break; diff --git a/lib/libc/stdtime/timelocal.c b/lib/libc/stdtime/timelocal.c index 6af316710de1..81e579a95d37 100644 --- a/lib/libc/stdtime/timelocal.c +++ b/lib/libc/stdtime/timelocal.c @@ -82,9 +82,8 @@ static const struct lc_time_T _C_time_locale = { /* ** c_fmt (ctime-compatible) - ** Not used, just compatibility placeholder. */ - NULL, + "%a %Ef %T %Y", /* am */ "AM", @@ -246,6 +245,8 @@ set_from_buf(const char *p, int num_lines) for (ap = (const char **) &_time_localebuf, i = 0; i < num_lines; ++ap, ++i) *ap = p += strlen(p) + 1; + /* XXX: always overwrite for ctime format parsing compatibility */ + _time_localebuf.c_fmt = _C_time_locale.c_fmt; if (num_lines >= LCTIME_SIZE_2) return; for (i = 0; i < 12; i++) diff --git a/lib/libc/stdtime/timelocal.h b/lib/libc/stdtime/timelocal.h index 4e4dc52fb2d0..06d650ab5433 100644 --- a/lib/libc/stdtime/timelocal.h +++ b/lib/libc/stdtime/timelocal.h @@ -40,7 +40,7 @@ struct lc_time_T { const char * weekday[7]; const char * X_fmt; const char * x_fmt; - const char * c_fmt; /* not used, just compatibility placeholder */ + const char * c_fmt; const char * am; const char * pm; const char * date_fmt;