version 1.105, 2006/06/28 20:19:05 |
version 1.106, 2006/07/07 17:37:17 |
|
|
#include "config.h" |
#include "config.h" |
#include "log.h" |
#include "log.h" |
#include "file.h" |
#include "file.h" |
|
#include "remote.h" |
|
|
extern char *__progname; |
extern char *__progname; |
|
|
|
|
int cvs_error = -1; /* set to the correct error code on failure */ |
int cvs_error = -1; /* set to the correct error code on failure */ |
int cvs_cmdop; |
int cvs_cmdop; |
int cvs_umask = CVS_UMASK_DEFAULT; |
int cvs_umask = CVS_UMASK_DEFAULT; |
|
int cvs_server_active = 0; |
|
|
char *cvs_tagname = NULL; |
char *cvs_tagname = NULL; |
char *cvs_defargs; /* default global arguments from .cvsrc */ |
char *cvs_defargs; /* default global arguments from .cvsrc */ |
|
|
|
|
cvs_log(LP_TRACE, "cvs_cleanup: removing temp files"); |
cvs_log(LP_TRACE, "cvs_cleanup: removing temp files"); |
cvs_worklist_run(&temp_files, cvs_worklist_unlink); |
cvs_worklist_run(&temp_files, cvs_worklist_unlink); |
|
|
|
if (cvs_server_active) { |
|
if (cvs_rmdir(cvs_server_path) == -1) |
|
cvs_log(LP_ERR, |
|
"warning: failed to remove server directory: %s", |
|
cvs_server_path); |
|
xfree(cvs_server_path); |
|
} |
} |
} |
|
|
void |
void |
|
|
struct passwd *pw; |
struct passwd *pw; |
struct stat st; |
struct stat st; |
char fpath[MAXPATHLEN]; |
char fpath[MAXPATHLEN]; |
|
char *root, *rootp; |
|
|
tzset(); |
tzset(); |
|
|
|
|
|
|
cvs_file_init(); |
cvs_file_init(); |
|
|
|
if (cvs_cmdop == CVS_OP_SERVER) { |
|
setvbuf(stdin, NULL, _IOLBF, 0); |
|
setvbuf(stdout, NULL, _IOLBF, 0); |
|
|
|
cvs_server_active = 1; |
|
root = cvs_remote_input(); |
|
if ((rootp = strchr(root, ' ')) == NULL) |
|
fatal("bad Root request"); |
|
cvs_rootstr = xstrdup(rootp + 1); |
|
xfree(root); |
|
} |
|
|
if ((current_cvsroot = cvsroot_get(".")) == NULL) { |
if ((current_cvsroot = cvsroot_get(".")) == NULL) { |
cvs_log(LP_ERR, |
cvs_log(LP_ERR, |
"No CVSROOT specified! Please use the '-d' option"); |
"No CVSROOT specified! Please use the '-d' option"); |
fatal("or set the CVSROOT environment variable."); |
fatal("or set the CVSROOT environment variable."); |
} |
} |
|
|
if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) |
if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) { |
fatal("remote setups are not supported yet"); |
if (cvs_server_active == 1) |
|
fatal("remote Root while already running as server?"); |
|
|
|
cvs_client_connect_to_server(); |
|
cmdp->cmd(cmd_argc, cmd_argv); |
|
cvs_cleanup(); |
|
return (0); |
|
} |
|
|
i = snprintf(fpath, sizeof(fpath), "%s/%s", current_cvsroot->cr_dir, |
i = snprintf(fpath, sizeof(fpath), "%s/%s", current_cvsroot->cr_dir, |
CVS_PATH_ROOT); |
CVS_PATH_ROOT); |