version 1.2, 1997/08/26 23:37:21 |
version 1.4, 1998/03/30 06:59:26 |
|
|
|
|
for (i = 0; i < 7; i++) { |
for (i = 0; i < 7; i++) { |
tm.tm_wday = i; |
tm.tm_wday = i; |
strftime(buf, sizeof(buf), "%a", &tm); |
l = strftime(buf, sizeof(buf), "%a", &tm); |
for (l = strlen(buf); |
for (; l > 0 && isspace((int)buf[l - 1]); l--) |
l > 0 && isspace((int)buf[l - 1]); |
|
l--) |
|
; |
; |
buf[l] = '\0'; |
buf[l] = '\0'; |
if (ndays[i].name != NULL) |
if (ndays[i].name != NULL) |
|
|
errx(1, "cannot allocate memory"); |
errx(1, "cannot allocate memory"); |
ndays[i].len = strlen(buf); |
ndays[i].len = strlen(buf); |
|
|
strftime(buf, sizeof(buf), "%A", &tm); |
l = strftime(buf, sizeof(buf), "%A", &tm); |
for (l = strlen(buf); |
for (; l > 0 && isspace((int)buf[l - 1]); l--) |
l > 0 && isspace((int)buf[l - 1]); |
|
l--) |
|
; |
; |
buf[l] = '\0'; |
buf[l] = '\0'; |
if (fndays[i].name != NULL) |
if (fndays[i].name != NULL) |
|
|
|
|
for (i = 0; i < 12; i++) { |
for (i = 0; i < 12; i++) { |
tm.tm_mon = i; |
tm.tm_mon = i; |
strftime(buf, sizeof(buf), "%b", &tm); |
l = strftime(buf, sizeof(buf), "%b", &tm); |
for (l = strlen(buf); |
for (; l > 0 && isspace((int)buf[l - 1]); l--) |
l > 0 && isspace((int)buf[l - 1]); |
|
l--) |
|
; |
; |
buf[l] = '\0'; |
buf[l] = '\0'; |
if (nmonths[i].name != NULL) |
if (nmonths[i].name != NULL) |
|
|
errx(1, "cannot allocate memory"); |
errx(1, "cannot allocate memory"); |
nmonths[i].len = strlen(buf); |
nmonths[i].len = strlen(buf); |
|
|
strftime(buf, sizeof(buf), "%B", &tm); |
l = strftime(buf, sizeof(buf), "%B", &tm); |
for (l = strlen(buf); |
for (; l > 0 && isspace((int)buf[l - 1]); l--) |
l > 0 && isspace((int)buf[l - 1]); |
|
l--) |
|
; |
; |
buf[l] = '\0'; |
buf[l] = '\0'; |
if (fnmonths[i].name != NULL) |
if (fnmonths[i].name != NULL) |
|
|
time_t now; |
time_t now; |
{ |
{ |
tp = localtime(&now); |
tp = localtime(&now); |
if (isleap(tp->tm_year + 1900)) { |
if (isleap(tp->tm_year + TM_YEAR_BASE)) { |
yrdays = DAYSPERLYEAR; |
yrdays = DAYSPERLYEAR; |
cumdays = daytab[1]; |
cumdays = daytab[1]; |
} else { |
} else { |
|
|
char *date; |
char *date; |
{ |
{ |
time_t t; |
time_t t; |
char save; |
|
int len; |
int len; |
struct tm tm; |
struct tm tm; |
|
|
|
|
*(date + len - 4) = '\0'; |
*(date + len - 4) = '\0'; |
tm.tm_year = atoi(date); |
tm.tm_year = atoi(date); |
|
|
/* tm_year up 1900 ... */ |
/* tm_year up TM_YEAR_BASE ... */ |
if (tm.tm_year > 1900) |
if (tm.tm_year < 70) |
tm.tm_year -= 1900; |
tm.tm_year += 2000 - TM_YEAR_BASE; |
|
else if (tm.tm_year < 100) |
|
tm.tm_year += 1900 - TM_YEAR_BASE; |
|
else if (tm.tm_year > TM_YEAR_BASE) |
|
tm.tm_year -= TM_YEAR_BASE; |
} |
} |
|
|
#if DEBUG |
#if DEBUG |