version 1.133, 2006/03/05 16:22:31 |
version 1.134, 2006/03/07 01:40:52 |
|
|
|
|
|
|
int rcs_errno = RCS_ERR_NOERR; |
int rcs_errno = RCS_ERR_NOERR; |
|
char *timezone_flag = NULL; |
|
|
|
|
static int rcs_write(RCSFILE *); |
static int rcs_write(RCSFILE *); |
static int rcs_parse_init(RCSFILE *); |
static int rcs_parse_init(RCSFILE *); |
static int rcs_parse_admin(RCSFILE *); |
static int rcs_parse_admin(RCSFILE *); |
|
|
rcs_expand_keywords(char *rcsfile, struct rcs_delta *rdp, char *data, |
rcs_expand_keywords(char *rcsfile, struct rcs_delta *rdp, char *data, |
size_t len, int mode) |
size_t len, int mode) |
{ |
{ |
|
int tzone; |
int kwtype, sizdiff; |
int kwtype, sizdiff; |
u_int i, j, found, start_offset, c_offset; |
u_int i, j, found, start_offset, c_offset; |
char *c, *kwstr, *start, *end, *tbuf; |
char *c, *kwstr, *start, *end, *tbuf, *m, *h; |
char expbuf[256], buf[256]; |
char expbuf[256], buf[256]; |
|
struct tm *tb, ltb; |
|
time_t now; |
|
char *fmt; |
|
|
kwtype = 0; |
kwtype = 0; |
kwstr = NULL; |
kwstr = NULL; |
i = 0; |
i = 0; |
|
|
/* |
/* |
|
* -z support for RCS |
|
*/ |
|
tb = &rdp->rd_date; |
|
if (timezone_flag != NULL) { |
|
if (!strcmp(timezone_flag, "LT")) { |
|
now = mktime(&rdp->rd_date); |
|
tb = localtime(&now); |
|
tb->tm_hour += ((int)tb->tm_gmtoff / 3600); |
|
} else { |
|
h = timezone_flag; |
|
if ((m = strrchr(timezone_flag, ':')) != NULL) |
|
*(m++) = '\0'; |
|
|
|
ltb = rdp->rd_date; |
|
tb = <b; |
|
|
|
tzone = atoi(h); |
|
|
|
if (tzone >= 24 && tzone <= -24) |
|
fatal("not a known time zone: %d", tzone); |
|
|
|
tb->tm_hour += tzone; |
|
if (tb->tm_hour >= 24 && tb->tm_hour <= -24) |
|
tb->tm_hour = 0; |
|
|
|
tb->tm_gmtoff += (tzone * 3600); |
|
|
|
if (m != NULL) { |
|
tzone = atoi(m); |
|
if (tzone >= 60) |
|
fatal("not a known time zone: %d", tzone); |
|
|
|
if ((tb->tm_min + tzone) >= 60) { |
|
tb->tm_hour++; |
|
tb->tm_min -= tzone; |
|
} else { |
|
tb->tm_min += tzone; |
|
} |
|
|
|
tb->tm_gmtoff += (tzone * 60); |
|
} |
|
} |
|
} |
|
|
|
/* |
* Keyword formats: |
* Keyword formats: |
* $Keyword$ |
* $Keyword$ |
* $Keyword: value$ |
* $Keyword: value$ |
|
|
} |
} |
|
|
if (kwtype & RCS_KW_DATE) { |
if (kwtype & RCS_KW_DATE) { |
strftime(buf, sizeof(buf), |
if (timezone_flag != NULL) |
"%Y/%m/%d %H:%M:%S ", |
fmt = "%Y/%m/%d %H:%M:%S%z "; |
&rdp->rd_date); |
else |
|
fmt = "%Y/%m/%d %H:%M:%S "; |
|
|
|
strftime(buf, sizeof(buf), fmt, tb); |
strlcat(expbuf, buf, sizeof(expbuf)); |
strlcat(expbuf, buf, sizeof(expbuf)); |
} |
} |
|
|