version 1.40, 2011/04/09 15:29:40 |
version 1.42, 2011/07/24 18:15:14 |
Line 69 a2roffsu(const char *src, struct roffsu *dst, enum rof |
|
Line 69 a2roffsu(const char *src, struct roffsu *dst, enum rof |
|
return(0); |
return(0); |
|
|
while (i < BUFSIZ) { |
while (i < BUFSIZ) { |
if ( ! isdigit((u_char)*src)) { |
if ( ! isdigit((unsigned char)*src)) { |
if ('.' != *src) |
if ('.' != *src) |
break; |
break; |
else if (hasd) |
else if (hasd) |
Line 130 a2roffsu(const char *src, struct roffsu *dst, enum rof |
|
Line 130 a2roffsu(const char *src, struct roffsu *dst, enum rof |
|
dst->scale = 0; |
dst->scale = 0; |
dst->unit = unit; |
dst->unit = unit; |
return(1); |
return(1); |
} |
|
|
|
|
|
/* |
|
* Correctly writes the time in nroff form, which differs from standard |
|
* form in that a space isn't printed in lieu of the extra %e field for |
|
* single-digit dates. |
|
*/ |
|
void |
|
time2a(time_t t, char *dst, size_t sz) |
|
{ |
|
struct tm tm; |
|
char buf[5]; |
|
char *p; |
|
size_t nsz; |
|
|
|
assert(sz > 1); |
|
localtime_r(&t, &tm); |
|
|
|
p = dst; |
|
nsz = 0; |
|
|
|
dst[0] = '\0'; |
|
|
|
if (0 == (nsz = strftime(p, sz, "%B ", &tm))) |
|
return; |
|
|
|
p += (int)nsz; |
|
sz -= nsz; |
|
|
|
if (0 == strftime(buf, sizeof(buf), "%e, ", &tm)) |
|
return; |
|
|
|
nsz = strlcat(p, buf + (' ' == buf[0] ? 1 : 0), sz); |
|
|
|
if (nsz >= sz) |
|
return; |
|
|
|
p += (int)nsz; |
|
sz -= nsz; |
|
|
|
(void)strftime(p, sz, "%Y", &tm); |
|
} |
} |
|
|
/* |
/* |