version 1.114, 2018/12/30 00:49:55 |
version 1.116, 2019/06/27 15:07:30 |
Line 494 time2a(time_t t) |
|
Line 494 time2a(time_t t) |
|
size_t ssz; |
size_t ssz; |
int isz; |
int isz; |
|
|
|
buf = NULL; |
tm = localtime(&t); |
tm = localtime(&t); |
if (tm == NULL) |
if (tm == NULL) |
return NULL; |
goto fail; |
|
|
/* |
/* |
* Reserve space: |
* Reserve space: |
Line 520 time2a(time_t t) |
|
Line 521 time2a(time_t t) |
|
* of looking at LC_TIME. |
* of looking at LC_TIME. |
*/ |
*/ |
|
|
if ((isz = snprintf(p, 4 + 1, "%d, ", tm->tm_mday)) == -1) |
isz = snprintf(p, 4 + 1, "%d, ", tm->tm_mday); |
|
if (isz < 0 || isz > 4) |
goto fail; |
goto fail; |
p += isz; |
p += isz; |
|
|
Line 530 time2a(time_t t) |
|
Line 532 time2a(time_t t) |
|
|
|
fail: |
fail: |
free(buf); |
free(buf); |
return NULL; |
return mandoc_strdup(""); |
} |
} |
|
|
char * |
char * |
Line 539 mandoc_normdate(struct roff_man *man, char *in, int ln |
|
Line 541 mandoc_normdate(struct roff_man *man, char *in, int ln |
|
char *cp; |
char *cp; |
time_t t; |
time_t t; |
|
|
|
if (man->quick) |
|
return mandoc_strdup(in == NULL ? "" : in); |
|
|
/* No date specified: use today's date. */ |
/* No date specified: use today's date. */ |
|
|
if (in == NULL || *in == '\0' || strcmp(in, "$" "Mdocdate$") == 0) { |
if (in == NULL || *in == '\0') |
mandoc_msg(MANDOCERR_DATE_MISSING, ln, pos, NULL); |
mandoc_msg(MANDOCERR_DATE_MISSING, ln, pos, NULL); |
|
if (in == NULL || *in == '\0' || strcmp(in, "$" "Mdocdate$") == 0) |
return time2a(time(NULL)); |
return time2a(time(NULL)); |
} |
|
|
|
/* Valid mdoc(7) date format. */ |
/* Valid mdoc(7) date format. */ |
|
|