| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-additional-options "-O2" } */ |
| 3 |
|
| 4 |
typedef long unsigned int size_t; |
| 5 |
typedef int wchar_t; |
| 6 |
struct tm |
| 7 |
{ |
| 8 |
int tm_mon; |
| 9 |
int tm_year; |
| 10 |
}; |
| 11 |
int abs (int); |
| 12 |
struct lc_time_T { const char *month[12]; }; |
| 13 |
struct __locale_t * __get_current_locale (void) { } |
| 14 |
const struct lc_time_T * __get_time_locale (struct __locale_t *locale) { } |
| 15 |
const wchar_t * __ctloc (wchar_t *buf, const char *elem, size_t *len_ret) { return buf; } |
| 16 |
size_t |
| 17 |
__strftime (wchar_t *s, size_t maxsize, const wchar_t *format, |
| 18 |
const struct tm *tim_p, struct __locale_t *locale) |
| 19 |
{ |
| 20 |
size_t count = 0; |
| 21 |
const wchar_t *ctloc; |
| 22 |
wchar_t ctlocbuf[256]; |
| 23 |
size_t i, ctloclen; |
| 24 |
const struct lc_time_T *_CurrentTimeLocale = __get_time_locale (locale); |
| 25 |
{ |
| 26 |
switch (*format) |
| 27 |
{ |
| 28 |
case L'B': |
| 29 |
(ctloc = __ctloc (ctlocbuf, _CurrentTimeLocale->month[tim_p->tm_mon], &ctloclen)); |
| 30 |
for (i = 0; i < ctloclen; i++) |
| 31 |
{ |
| 32 |
if (count < maxsize - 1) |
| 33 |
s[count++] = ctloc[i]; |
| 34 |
else |
| 35 |
return 0; |
| 36 |
{ |
| 37 |
int century = tim_p->tm_year >= 0 |
| 38 |
? tim_p->tm_year / 100 + 1900 / 100 |
| 39 |
: abs (tim_p->tm_year + 1900) / 100; |
| 40 |
} |
| 41 |
} |
| 42 |
} |
| 43 |
} |
| 44 |
} |