summaryrefslogtreecommitdiffstats
path: root/usr.bin/ncal/ncal.c
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2001-03-22 00:25:26 +0000
committerache <ache@FreeBSD.org>2001-03-22 00:25:26 +0000
commitd993b34b6d31778f0b7462c224f7c5405979b7c7 (patch)
treeee6963470e3eac030819fe07730f8b2c759bc11c /usr.bin/ncal/ncal.c
parent24af4863f09ecb04b26ed8de47a5a52075238c82 (diff)
downloadFreeBSD-src-d993b34b6d31778f0b7462c224f7c5405979b7c7.zip
FreeBSD-src-d993b34b6d31778f0b7462c224f7c5405979b7c7.tar.gz
Uppercase first month letter
Terminate weekday string
Diffstat (limited to 'usr.bin/ncal/ncal.c')
-rw-r--r--usr.bin/ncal/ncal.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/ncal/ncal.c b/usr.bin/ncal/ncal.c
index fcae694..0ff3576 100644
--- a/usr.bin/ncal/ncal.c
+++ b/usr.bin/ncal/ncal.c
@@ -30,6 +30,7 @@ static const char rcsid[] =
#endif /* not lint */
#include <calendar.h>
+#include <ctype.h>
#include <err.h>
#include <langinfo.h>
#include <locale.h>
@@ -200,8 +201,9 @@ main(int argc, char *argv[])
* and use the country code to determine the default
* switchdate and date format from the switches table.
*/
- if ((locale = setlocale(LC_TIME, "")) == NULL)
+ if (setlocale(LC_ALL, "") == NULL)
warn("setlocale");
+ locale = setlocale(LC_TIME, NULL);
if (locale == NULL || locale == "C")
locale = "_US";
q = switches + sizeof(switches) / sizeof(struct djswitch);
@@ -583,6 +585,7 @@ mkmonth(int y, int m, int jd_flag, struct monthlines *mlines)
memset(&tm, 0, sizeof(tm));
tm.tm_mon = m;
strftime(mlines->name, sizeof(mlines->name), "%OB", &tm);
+ mlines->name[0] = toupper((unsigned char)mlines->name[0]);
/*
* Set first and last to the day number of the first day of this
@@ -674,6 +677,7 @@ mkmonthb(int y, int m, int jd_flag, struct monthlines *mlines)
memset(&tm, 0, sizeof(tm));
tm.tm_mon = m;
strftime(mlines->name, sizeof(mlines->name), "%OB", &tm);
+ mlines->name[0] = toupper((unsigned char)mlines->name[0]);
/*
* Set first and last to the day number of the first day of this
@@ -745,6 +749,7 @@ mkweekdays(struct weekdays *wds)
tm.tm_wday = (i+1) % 7;
strftime(wds->names[i], 4, "%a", &tm);
wds->names[i][2] = ' ';
+ wds->names[i][3] = '\0';
}
}
OpenPOWER on IntegriCloud