diff options
author | dt <dt@FreeBSD.org> | 1999-09-11 21:35:21 +0000 |
---|---|---|
committer | dt <dt@FreeBSD.org> | 1999-09-11 21:35:21 +0000 |
commit | 563a7a9ae192e9ef2ca5ca45263f32cdb350cd74 (patch) | |
tree | 3cb7079ddfd2c249ce7d44e9fea5f7864f17f9ad /lib/libc/stdtime/strftime.c | |
parent | 61e17cfe0ebde91fdd82ad1508f6ea5dd721ebd8 (diff) | |
download | FreeBSD-src-563a7a9ae192e9ef2ca5ca45263f32cdb350cd74.zip FreeBSD-src-563a7a9ae192e9ef2ca5ca45263f32cdb350cd74.tar.gz |
Implement new format specifier for strftime: %OB, alternative national
representation of the full month name. In the Russian locale, this alternative
will be "nominative case", useful when the date designate month as a whole.
E.g. month heading in a calendar. I hope it can be useful for some other
locales too.
Discussed with: wollman, ache
Diffstat (limited to 'lib/libc/stdtime/strftime.c')
-rw-r--r-- | lib/libc/stdtime/strftime.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libc/stdtime/strftime.c b/lib/libc/stdtime/strftime.c index b70b216..5800fe8 100644 --- a/lib/libc/stdtime/strftime.c +++ b/lib/libc/stdtime/strftime.c @@ -75,8 +75,10 @@ _fmt(format, t, pt, ptlim) char *pt; const char *const ptlim; { + int alternative; for ( ; *format; ++format) { if (*format == '%') { + alternative = 0; label: switch (*++format) { case '\0': @@ -93,8 +95,9 @@ label: pt, ptlim); continue; case 'B': - pt = _add((t->tm_mon < 0 || t->tm_mon > 11) ? - "?" : Locale->month[t->tm_mon], + pt = _add((t->tm_mon < 0 || t->tm_mon > 11) ? + "?" : (alternative ? Locale->alt_month : + Locale->month)[t->tm_mon], pt, ptlim); continue; case 'b': @@ -136,6 +139,7 @@ label: ** representations. ** (ado, 5/24/93) */ + alternative = 1; goto label; case 'e': pt = _conv(t->tm_mday, "%2d", pt, ptlim); |