diff options
author | dd <dd@FreeBSD.org> | 2001-07-13 13:59:24 +0000 |
---|---|---|
committer | dd <dd@FreeBSD.org> | 2001-07-13 13:59:24 +0000 |
commit | bd37181c768a67113428f861ea10a66df337a15d (patch) | |
tree | 35dbc220958bf6704b9a286a493c56b90660e7b2 /lib/libc/stdtime/strptime.c | |
parent | 8795e3b5743f8bb3845688054fdd55c10e374934 (diff) | |
download | FreeBSD-src-bd37181c768a67113428f861ea10a66df337a15d.zip FreeBSD-src-bd37181c768a67113428f861ea10a66df337a15d.tar.gz |
Recognize the %s format.
Submitted by: Thomas Zenker <thz@lennartz-electronic.de> and
Maxim Konovalov <maxim@macomnet.ru>, respectively
Reviewed by: -audit
Diffstat (limited to 'lib/libc/stdtime/strptime.c')
-rw-r--r-- | lib/libc/stdtime/strptime.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/libc/stdtime/strptime.c b/lib/libc/stdtime/strptime.c index 09f8e18..bcda42b 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 <time.h> #include <ctype.h> +#include <limits.h> +#include <stdlib.h> #include <string.h> #include <pthread.h> #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)) |