glibc/tests/Regression/bz657570-strptime-s-b-descriptor-should-be-greedy/strptime.c
Sergey Kolosov ab4bc8a24e Extend the test coverage
Move some of the RHEL QE testcases upstream to Fedora.
2022-05-31 09:29:27 +02:00

23 lines
484 B
C

#define _XOPEN_SOURCE
#include <locale.h>
#include <time.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
int
main (void)
{
if (setlocale (LC_ALL, "fi_FI.utf8") == NULL)
{
puts ("cannot set locale");
return 1;
}
struct tm tm;
static const char s[] = "marras";
char *r = strptime (s, "%b", &tm);
printf ("r = %p, r-s = %ju, tm.tm_mon = %d\n", r, (uintmax_t)(r - s),
tm.tm_mon);
return r == NULL || r - s != strlen(s) || tm.tm_mon != 10;
}