From 315dd16dfc8d8aa97a0ea73a3cddc9d68e952fd4 Mon Sep 17 00:00:00 2001 From: Yui Hirasawa Date: Sun, 31 Aug 2014 01:00:56 +0300 Subject: [PATCH] Added cardinal and normal number options for seasons. --- ddate.1 | 4 ++++ ddate.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/ddate.1 b/ddate.1 index ec4ee81..fad61ee 100644 --- a/ddate.1 +++ b/ddate.1 @@ -31,6 +31,10 @@ Abbreviated name of the day of the week (i.e., SM) Full name of the season (i.e., Chaos) .IP %b Abbreviated name of the season (i.e., Chs) +.IP %u +Cardinal number of the season (i.e., 4) +.IP %U +Ordinal number of the season (i.e., 4th) .IP %d Cardinal number of day in season (i.e., 23) .IP %e diff --git a/ddate.c b/ddate.c index 4c2a0f8..6f041c4 100644 --- a/ddate.c +++ b/ddate.c @@ -285,6 +285,8 @@ void format(char *buf, const char* fmt, struct disc_time dt) case 'a': wibble=day_short[dt.yday%5]; break; case 'B': wibble=season_long[dt.season]; break; case 'b': wibble=season_short[dt.season]; break; + case 'u': sprintf(snarf, "%u", dt.season+1); wibble=snarf; break; + case 'U': sprintf(snarf, "%u%s", dt.season+1, ending(dt.season+1)); wibble=snarf; break; case 'd': sprintf(snarf, "%d", dt.day+1); wibble=snarf; break; case 'e': sprintf(snarf, "%d%s", dt.day+1, ending(dt.day+1)); wibble=snarf; break;