version 1.6, 2004/07/26 17:28:59 |
version 1.7, 2004/07/27 13:55:00 |
|
|
static int cvs_resp_modxpand (int, char *); |
static int cvs_resp_modxpand (int, char *); |
|
|
|
|
|
static const char *cvs_months[] = { |
|
"Jan", |
|
"Feb", |
|
"Mar", |
|
"Apr", |
|
"May", |
|
"June", |
|
"July", |
|
"Aug", |
|
"Sep", |
|
"Oct", |
|
"Nov", |
|
"Dec" |
|
}; |
|
|
|
|
|
|
|
|
|
|
struct cvs_req { |
struct cvs_req { |
int req_id; |
int req_id; |
char req_str[32]; |
char req_str[32]; |
|
|
static char *cvs_mt_stack[CVS_MTSTK_MAXDEPTH]; |
static char *cvs_mt_stack[CVS_MTSTK_MAXDEPTH]; |
static u_int cvs_mtstk_depth = 0; |
static u_int cvs_mtstk_depth = 0; |
|
|
|
static struct tm cvs_modtime; |
|
|
|
|
#define CVS_NBREQ (sizeof(cvs_requests)/sizeof(cvs_requests[0])) |
#define CVS_NBREQ (sizeof(cvs_requests)/sizeof(cvs_requests[0])) |
#define CVS_NBRESP (sizeof(cvs_responses)/sizeof(cvs_responses[0])) |
#define CVS_NBRESP (sizeof(cvs_responses)/sizeof(cvs_responses[0])) |
|
|
|
|
{ |
{ |
char rpath[MAXPATHLEN]; |
char rpath[MAXPATHLEN]; |
struct stat st; |
struct stat st; |
|
CVSFILE *cf; |
|
|
/* get the remote path */ |
/* get the remote path */ |
cvs_client_getln(rpath, sizeof(rpath)); |
cvs_client_getln(rpath, sizeof(rpath)); |
|
|
/* if the directory doesn't exist, create it */ |
/* if the directory doesn't exist, create it */ |
if (stat(line, &st) == -1) { |
if (stat(line, &st) == -1) { |
|
/* attempt to create it */ |
if (errno != ENOENT) { |
if (errno != ENOENT) { |
cvs_log(LP_ERRNO, "failed to stat %s", line); |
cvs_log(LP_ERRNO, "failed to stat %s", line); |
} |
} |
else if (mkdir(line, 0755) == -1) { |
else { |
cvs_log(LP_ERRNO, "failed to create %s", line); |
cf = cvs_file_create(line, DT_DIR, 0755); |
return (-1); |
if (cf == NULL) |
|
return (-1); |
|
cf->cf_ddat->cd_repo = strdup(line); |
|
cf->cf_ddat->cd_root = cvs_root; |
|
cvs_mkadmin(cf, 0755); |
|
|
|
cf->cf_ddat->cd_root = NULL; |
|
cvs_file_free(cf); |
} |
} |
} |
} |
|
|
|
|
static int |
static int |
cvs_resp_modtime(int type, char *line) |
cvs_resp_modtime(int type, char *line) |
{ |
{ |
|
u_int i; |
|
char mon[8]; |
|
|
|
cvs_modtime.tm_yday = 0; |
|
cvs_modtime.tm_wday = 0; |
|
|
|
sscanf(line, "%d %8s %d %2d:%2d:%2d", &cvs_modtime.tm_mday, mon, |
|
&cvs_modtime.tm_year, &cvs_modtime.tm_hour, &cvs_modtime.tm_min, |
|
&cvs_modtime.tm_sec); |
|
cvs_modtime.tm_year -= 1900; |
|
|
|
for (i = 0; i < sizeof(cvs_months)/sizeof(cvs_months[0]); i++) { |
|
if (strcmp(cvs_months[i], mon) == 0) |
|
cvs_modtime.tm_mon = (int)i; |
|
} |
|
|
return (0); |
return (0); |
} |
} |
|
|
|
|
static int |
static int |
cvs_resp_updated(int type, char *line) |
cvs_resp_updated(int type, char *line) |
{ |
{ |
char path[MAXPATHLEN], cksum_buf[CVS_CKSUM_LEN]; |
size_t len; |
|
char tbuf[32], path[MAXPATHLEN], cksum_buf[CVS_CKSUM_LEN]; |
|
CVSENTRIES *ef; |
struct cvs_ent *ep; |
struct cvs_ent *ep; |
|
|
if (type == CVS_RESP_CREATED) { |
if (type == CVS_RESP_CREATED) { |
|
|
ep = cvs_ent_parse(path); |
ep = cvs_ent_parse(path); |
if (ep == NULL) |
if (ep == NULL) |
return (-1); |
return (-1); |
|
|
|
/* set the timestamp as the last one received from Mod-time */ |
|
ep->ce_timestamp = asctime_r(&cvs_modtime, tbuf); |
|
len = strlen(tbuf); |
|
if ((len > 0) && (tbuf[len - 1] == '\n')) |
|
tbuf[--len] = '\0'; |
|
|
|
ef = cvs_ent_open(line, O_WRONLY); |
|
if (ef == NULL) |
|
return (-1); |
|
|
|
cvs_ent_add(ef, ep); |
|
cvs_ent_close(ef); |
} |
} |
else if (type == CVS_RESP_UPDEXIST) { |
else if (type == CVS_RESP_UPDEXIST) { |
} |
} |