version 1.16, 2004/08/02 17:16:08 |
version 1.17, 2004/08/02 22:45:57 |
|
|
{ CVS_RESP_TEMPLATE, "Template", cvs_resp_template }, |
{ CVS_RESP_TEMPLATE, "Template", cvs_resp_template }, |
}; |
}; |
|
|
|
#define CVS_NBREQ (sizeof(cvs_requests)/sizeof(cvs_requests[0])) |
|
#define CVS_NBRESP (sizeof(cvs_responses)/sizeof(cvs_responses[0])) |
|
|
|
|
|
/* |
|
* The MT command uses scoping to tag the data. Whenever we encouter a '+', |
|
* we push the name of the tag on the stack, and we pop it when we encounter |
|
* a '-' with the same name. |
|
*/ |
|
|
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 time_t cvs_modtime = 0; |
static time_t cvs_modtime = 0; |
|
|
|
|
#define CVS_NBREQ (sizeof(cvs_requests)/sizeof(cvs_requests[0])) |
|
#define CVS_NBRESP (sizeof(cvs_responses)/sizeof(cvs_responses[0])) |
|
|
|
/* mask of requets supported by server */ |
/* mask of requets supported by server */ |
static u_char cvs_server_validreq[CVS_REQ_MAX + 1]; |
static u_char cvs_server_validreq[CVS_REQ_MAX + 1]; |
|
|
|
/* last checksum received */ |
char *cvs_fcksum = NULL; |
char *cvs_fcksum = NULL; |
|
|
mode_t cvs_lastmode = 0; |
mode_t cvs_lastmode = 0; |
|
|
|
/* hack to receive the remote version without outputting it */ |
|
static u_int cvs_version_sent = 0; |
|
|
|
|
static char cvs_proto_buf[4096]; |
static char cvs_proto_buf[4096]; |
|
|
/* |
/* |
|
|
* Open a client connection to the cvs server whose address is given in |
* Open a client connection to the cvs server whose address is given in |
* the <root> variable. The method used to connect depends on the |
* the <root> variable. The method used to connect depends on the |
* setting of the CVS_RSH variable. |
* setting of the CVS_RSH variable. |
|
* Once the connection has been established, we first send the list of |
|
* responses we support and request the list of supported requests from the |
|
* server. Then, a version request is sent and various global flags are sent. |
* Returns 0 on success, or -1 on failure. |
* Returns 0 on success, or -1 on failure. |
*/ |
*/ |
|
|
|
|
return (-1); |
return (-1); |
} |
} |
|
|
|
if (cvs_sendreq(root, CVS_REQ_VERSION, NULL) < 0) |
|
cvs_log(LP_ERR, "failed to get remote version"); |
|
|
/* now share our global options with the server */ |
/* now share our global options with the server */ |
if (verbosity == 1) |
if (verbosity == 1) |
cvs_sendreq(root, CVS_REQ_GLOBALOPT, "-q"); |
cvs_sendreq(root, CVS_REQ_GLOBALOPT, "-q"); |
|
|
fflush(stderr); |
fflush(stderr); |
return (0); |
return (0); |
case CVS_RESP_M: |
case CVS_RESP_M: |
|
if (cvs_version_sent) { |
|
/* |
|
* Instead of outputting the line, we save it as the |
|
* remote server's version string. |
|
*/ |
|
cvs_version_sent = 0; |
|
root->cr_version = strdup(line); |
|
return (0); |
|
} |
stream = stdout; |
stream = stdout; |
break; |
break; |
case CVS_RESP_E: |
case CVS_RESP_E: |
|
|
cvs_log(LP_ERRNO, "failed to send request to server"); |
cvs_log(LP_ERRNO, "failed to send request to server"); |
return (-1); |
return (-1); |
} |
} |
|
|
|
if (rid == CVS_REQ_VERSION) |
|
cvs_version_sent = 1; |
|
|
if (req->req_flags & CVS_REQF_RESP) |
if (req->req_flags & CVS_REQF_RESP) |
ret = cvs_getresp(root); |
ret = cvs_getresp(root); |