From 427fc5ed6fc8d69e6c65c445a9ff61017ce2d2ec Mon Sep 17 00:00:00 2001 From: Dima Dorfman Date: Fri, 13 Jul 2001 13:59:24 +0000 Subject: [PATCH] Recognize the %s format. Submitted by: Thomas Zenker and Maxim Konovalov , respectively Reviewed by: -audit --- lib/libc/stdtime/strptime.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/libc/stdtime/strptime.c b/lib/libc/stdtime/strptime.c index 09f8e18e579..bcda42b3860 100644 --- a/lib/libc/stdtime/strptime.c +++ b/lib/libc/stdtime/strptime.c @@ -67,6 +67,8 @@ static char sccsid[] = "@(#)strptime.c 0.1 (Powerdog) 94/03/27"; #include "namespace.h" #include #include +#include +#include #include #include #include "un-namespace.h" @@ -445,6 +447,20 @@ label: ptr++; break; + case 's': + { + char *cp; + time_t t; + + t = strtol(buf, &cp, 10); + if (t == LONG_MAX) + return 0; + buf = cp; + gmtime_r(&t, tm); + got_GMT = 1; + } + break; + case 'Y': case 'y': if (*buf == 0 || isspace((unsigned char)*buf))