mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-27 11:22:43 +00:00
Properly deal with one char weekdays
This commit is contained in:
parent
e036a70eb9
commit
3740863d60
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=74618
@ -740,16 +740,20 @@ mkmonthb(int y, int m, int jd_flag, struct monthlines *mlines)
|
||||
void
|
||||
mkweekdays(struct weekdays *wds)
|
||||
{
|
||||
int i;
|
||||
int i, len;
|
||||
struct tm tm;
|
||||
char buf[20];
|
||||
|
||||
memset(&tm, 0, sizeof(tm));
|
||||
|
||||
for (i = 0; i != 7; i++) {
|
||||
tm.tm_wday = (i+1) % 7;
|
||||
strftime(wds->names[i], 4, "%a", &tm);
|
||||
wds->names[i][2] = ' ';
|
||||
wds->names[i][3] = '\0';
|
||||
strftime(buf, sizeof(buf), "%a", &tm);
|
||||
len = strlen(buf);
|
||||
if (len > 2)
|
||||
len = 2;
|
||||
strcpy(wds->names[i], " ");
|
||||
strncpy(wds->names[i] + 2 - len, buf, len);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user