version 1.30, 2015/10/23 11:43:16 |
version 1.32, 2015/12/08 19:04:50 |
|
|
static struct fixs nmonths[13]; /* short national month names */ |
static struct fixs nmonths[13]; /* short national month names */ |
|
|
void |
void |
|
fill_print_date(struct match *m, struct tm *tm) |
|
{ |
|
if (strftime(m->print_date, sizeof(m->print_date), |
|
daynames ? "%a %b %d" : "%b %d", tm) == 0) |
|
m->print_date[sizeof(m->print_date) - 1] = '\0'; |
|
} |
|
|
|
void |
setnnames(void) |
setnnames(void) |
{ |
{ |
char buf[80]; |
char buf[80]; |
|
|
for (; l > 0 && isspace((unsigned char)buf[l - 1]); l--) |
for (; l > 0 && isspace((unsigned char)buf[l - 1]); l--) |
; |
; |
buf[l] = '\0'; |
buf[l] = '\0'; |
if (ndays[i].name != NULL) |
free(ndays[i].name); |
free(ndays[i].name); |
|
if ((ndays[i].name = strdup(buf)) == NULL) |
if ((ndays[i].name = strdup(buf)) == NULL) |
err(1, NULL); |
err(1, NULL); |
ndays[i].len = strlen(buf); |
ndays[i].len = strlen(buf); |
|
|
for (; l > 0 && isspace((unsigned char)buf[l - 1]); l--) |
for (; l > 0 && isspace((unsigned char)buf[l - 1]); l--) |
; |
; |
buf[l] = '\0'; |
buf[l] = '\0'; |
if (fndays[i].name != NULL) |
free(fndays[i].name); |
free(fndays[i].name); |
|
if ((fndays[i].name = strdup(buf)) == NULL) |
if ((fndays[i].name = strdup(buf)) == NULL) |
err(1, NULL); |
err(1, NULL); |
fndays[i].len = strlen(buf); |
fndays[i].len = strlen(buf); |
|
|
for (; l > 0 && isspace((unsigned char)buf[l - 1]); l--) |
for (; l > 0 && isspace((unsigned char)buf[l - 1]); l--) |
; |
; |
buf[l] = '\0'; |
buf[l] = '\0'; |
if (nmonths[i].name != NULL) |
free(nmonths[i].name); |
free(nmonths[i].name); |
|
if ((nmonths[i].name = strdup(buf)) == NULL) |
if ((nmonths[i].name = strdup(buf)) == NULL) |
err(1, NULL); |
err(1, NULL); |
nmonths[i].len = strlen(buf); |
nmonths[i].len = strlen(buf); |
|
|
for (; l > 0 && isspace((unsigned char)buf[l - 1]); l--) |
for (; l > 0 && isspace((unsigned char)buf[l - 1]); l--) |
; |
; |
buf[l] = '\0'; |
buf[l] = '\0'; |
if (fnmonths[i].name != NULL) |
free(fnmonths[i].name); |
free(fnmonths[i].name); |
|
if ((fnmonths[i].name = strdup(buf)) == NULL) |
if ((fnmonths[i].name = strdup(buf)) == NULL) |
err(1, NULL); |
err(1, NULL); |
fnmonths[i].len = strlen(buf); |
fnmonths[i].len = strlen(buf); |
|
|
} |
} |
|
|
(void)mktime(&tmtmp); |
(void)mktime(&tmtmp); |
if (strftime(tmp->print_date, |
fill_print_date(tmp, &tmtmp); |
sizeof(tmp->print_date), |
|
/* "%a %b %d", &tm); Skip weekdays */ |
|
"%b %d", &tmtmp) == 0) |
|
tmp->print_date[sizeof(tmp->print_date) - 1] = '\0'; |
|
|
|
tmp->var = varp; |
tmp->var = varp; |
tmp->next = NULL; |
tmp->next = NULL; |
return(tmp); |
return(tmp); |
|
|
if ((tmp = malloc(sizeof(struct match))) == NULL) |
if ((tmp = malloc(sizeof(struct match))) == NULL) |
err(1, NULL); |
err(1, NULL); |
tmp->when = ttmp; |
tmp->when = ttmp; |
if (strftime(tmp->print_date, |
fill_print_date(tmp, &tmtmp); |
sizeof(tmp->print_date), |
|
/* "%a %b %d", &tm); Skip weekdays */ |
|
"%b %d", &tmtmp) == 0) |
|
tmp->print_date[sizeof(tmp->print_date) - 1] = '\0'; |
|
tmp->bodun = bodun && tdiff == -1; |
tmp->bodun = bodun && tdiff == -1; |
tmp->var = varp; |
tmp->var = varp; |
tmp->next = NULL; |
tmp->next = NULL; |