version 1.10, 2004/09/16 15:02:21 |
version 1.11, 2004/09/25 11:06:50 |
|
|
return (NULL); |
return (NULL); |
} |
} |
|
|
|
rfp->rf_branch = rcsnum_alloc(); |
|
if (rfp->rf_branch == NULL) { |
|
rcs_close(rfp); |
|
return (NULL); |
|
} |
|
|
rfp->rf_path = strdup(path); |
rfp->rf_path = strdup(path); |
if (rfp->rf_path == NULL) { |
if (rfp->rf_path == NULL) { |
cvs_log(LP_ERRNO, "failed to duplicate RCS file path"); |
cvs_log(LP_ERRNO, "failed to duplicate RCS file path"); |
|
|
|
|
if (rfp->rf_head != NULL) |
if (rfp->rf_head != NULL) |
rcsnum_free(rfp->rf_head); |
rcsnum_free(rfp->rf_head); |
|
if (rfp->rf_branch != NULL) |
|
rcsnum_free(rfp->rf_branch); |
|
|
if (rfp->rf_path != NULL) |
if (rfp->rf_path != NULL) |
free(rfp->rf_path); |
free(rfp->rf_path); |
|
|
} |
} |
|
|
symp->rs_num = rcsnum_alloc(); |
symp->rs_num = rcsnum_alloc(); |
|
if (symp->rs_num == NULL) { |
|
free(symp); |
|
return (-1); |
|
} |
rcsnum_cpy(snum, symp->rs_num, 0); |
rcsnum_cpy(snum, symp->rs_num, 0); |
|
|
TAILQ_INSERT_HEAD(&(rfp->rf_symbols), symp, rs_list); |
TAILQ_INSERT_HEAD(&(rfp->rf_symbols), symp, rs_list); |
|
|
* This will need some rework to support sub branches. |
* This will need some rework to support sub branches. |
*/ |
*/ |
crev = rcsnum_alloc(); |
crev = rcsnum_alloc(); |
|
if (crev == NULL) |
|
return (NULL); |
rcsnum_cpy(rfp->rf_head, crev, 0); |
rcsnum_cpy(rfp->rf_head, crev, 0); |
do { |
do { |
crev->rn_id[crev->rn_len - 1]--; |
crev->rn_id[crev->rn_len - 1]--; |
|
|
memset(rdp, 0, sizeof(*rdp)); |
memset(rdp, 0, sizeof(*rdp)); |
|
|
rdp->rd_num = rcsnum_alloc(); |
rdp->rd_num = rcsnum_alloc(); |
|
if (rdp->rd_num == NULL) { |
|
rcs_freedelta(rdp); |
|
return (-1); |
|
} |
rdp->rd_next = rcsnum_alloc(); |
rdp->rd_next = rcsnum_alloc(); |
|
if (rdp->rd_next == NULL) { |
|
rcs_freedelta(rdp); |
|
return (-1); |
|
} |
|
|
TAILQ_INIT(&(rdp->rd_branches)); |
TAILQ_INIT(&(rdp->rd_branches)); |
|
|
|
|
|
|
if (tok == RCS_TOK_DATE) { |
if (tok == RCS_TOK_DATE) { |
datenum = rcsnum_alloc(); |
datenum = rcsnum_alloc(); |
|
if (datenum == NULL) { |
|
rcs_freedelta(rdp); |
|
return (-1); |
|
} |
rcsnum_aton(tokstr, NULL, datenum); |
rcsnum_aton(tokstr, NULL, datenum); |
if (datenum->rn_len != 6) { |
if (datenum->rn_len != 6) { |
cvs_log(LP_ERR, |
cvs_log(LP_ERR, |
|
|
} |
} |
|
|
symp->rs_num = rcsnum_alloc(); |
symp->rs_num = rcsnum_alloc(); |
|
if (symp->rs_num == NULL) { |
|
cvs_log(LP_ERRNO, "failed to allocate rcsnum info"); |
|
free(symp); |
|
return (-1); |
|
} |
|
|
type = rcs_gettok(rfp); |
type = rcs_gettok(rfp); |
if (type != RCS_TOK_COLON) { |
if (type != RCS_TOK_COLON) { |
cvs_log(LP_ERR, "unexpected token `%s' in symbol list", |
cvs_log(LP_ERR, "unexpected token `%s' in symbol list", |
RCS_TOKSTR(rfp)); |
RCS_TOKSTR(rfp)); |
|
rcsnum_free(symp->rs_num); |
free(symp->rs_name); |
free(symp->rs_name); |
free(symp); |
free(symp); |
return (-1); |
return (-1); |
|
|
if (type != RCS_TOK_NUM) { |
if (type != RCS_TOK_NUM) { |
cvs_log(LP_ERR, "unexpected token `%s' in symbol list", |
cvs_log(LP_ERR, "unexpected token `%s' in symbol list", |
RCS_TOKSTR(rfp)); |
RCS_TOKSTR(rfp)); |
|
rcsnum_free(symp->rs_num); |
free(symp->rs_name); |
free(symp->rs_name); |
free(symp); |
free(symp); |
return (-1); |
return (-1); |
|
|
if (rcsnum_aton(RCS_TOKSTR(rfp), NULL, symp->rs_num) < 0) { |
if (rcsnum_aton(RCS_TOKSTR(rfp), NULL, symp->rs_num) < 0) { |
cvs_log(LP_ERR, "failed to parse RCS NUM `%s'", |
cvs_log(LP_ERR, "failed to parse RCS NUM `%s'", |
RCS_TOKSTR(rfp)); |
RCS_TOKSTR(rfp)); |
|
rcsnum_free(symp->rs_num); |
free(symp->rs_name); |
free(symp->rs_name); |
free(symp); |
free(symp); |
return (-1); |
return (-1); |
|
|
return (-1); |
return (-1); |
} |
} |
lkp->rl_num = rcsnum_alloc(); |
lkp->rl_num = rcsnum_alloc(); |
|
if (lkp->rl_num == NULL) { |
|
free(lkp); |
|
return (-1); |
|
} |
|
|
type = rcs_gettok(rfp); |
type = rcs_gettok(rfp); |
if (type != RCS_TOK_COLON) { |
if (type != RCS_TOK_COLON) { |
|
|
return (-1); |
return (-1); |
} |
} |
brp->rb_num = rcsnum_alloc(); |
brp->rb_num = rcsnum_alloc(); |
|
if (brp->rb_num == NULL) { |
|
free(brp); |
|
return (-1); |
|
} |
|
|
rcsnum_aton(RCS_TOKSTR(rfp), NULL, brp->rb_num); |
rcsnum_aton(RCS_TOKSTR(rfp), NULL, brp->rb_num); |
|
|
TAILQ_INSERT_TAIL(&(rdp->rd_branches), brp, rb_list); |
TAILQ_INSERT_TAIL(&(rdp->rd_branches), brp, rb_list); |
|
|
*(bp++) = ch; |
*(bp++) = ch; |
while (bp <= bep - 1) { |
while (bp <= bep - 1) { |
ch = getc(pdp->rp_file); |
ch = getc(pdp->rp_file); |
if (!isalnum(ch)) { |
if (!isalnum(ch) && ch != '_' && ch != '-') { |
ungetc(ch, pdp->rp_file); |
ungetc(ch, pdp->rp_file); |
break; |
break; |
} |
} |
|
|
/* not a keyword, assume it's just a string */ |
/* not a keyword, assume it's just a string */ |
if (type == RCS_TOK_ERR) |
if (type == RCS_TOK_ERR) |
type = RCS_TOK_STRING; |
type = RCS_TOK_STRING; |
|
|
} |
} |
else if (ch == '@') { |
else if (ch == '@') { |
/* we have a string */ |
/* we have a string */ |