version 1.73, 2005/07/24 17:12:25 |
version 1.74, 2005/07/25 11:28:59 |
|
|
#include "rcs.h" |
#include "rcs.h" |
#include "file.h" |
#include "file.h" |
|
|
#define CVS_VERSION_MAJOR 0 |
#define CVS_VERSION_MAJOR 0 |
#define CVS_VERSION_MINOR 3 |
#define CVS_VERSION_MINOR 3 |
#define CVS_VERSION "OpenCVS 0.3" |
#define CVS_VERSION "OpenCVS 0.3" |
|
|
|
|
#define CVS_HIST_CACHE 128 |
#define CVS_HIST_CACHE 128 |
#define CVS_HIST_NBFLD 6 |
#define CVS_HIST_NBFLD 6 |
|
|
|
|
#define CVS_CKSUM_LEN 33 /* length of a CVS checksum string */ |
#define CVS_CKSUM_LEN 33 /* length of a CVS checksum string */ |
|
|
/* error codes */ |
/* error codes */ |
#define CVS_EX_ERR -1 |
#define CVS_EX_ERR -1 |
|
|
#define CVS_EX_BADROOT 6 |
#define CVS_EX_BADROOT 6 |
|
|
/* operations */ |
/* operations */ |
#define CVS_OP_UNKNOWN 0 |
#define CVS_OP_UNKNOWN 0 |
#define CVS_OP_ADD 1 |
#define CVS_OP_ADD 1 |
#define CVS_OP_ADMIN 2 |
#define CVS_OP_ADMIN 2 |
#define CVS_OP_ANNOTATE 3 |
#define CVS_OP_ANNOTATE 3 |
#define CVS_OP_CHECKOUT 4 |
#define CVS_OP_CHECKOUT 4 |
#define CVS_OP_COMMIT 5 |
#define CVS_OP_COMMIT 5 |
#define CVS_OP_DIFF 6 |
#define CVS_OP_DIFF 6 |
#define CVS_OP_EDIT 7 |
#define CVS_OP_EDIT 7 |
#define CVS_OP_EDITORS 8 |
#define CVS_OP_EDITORS 8 |
#define CVS_OP_EXPORT 9 |
#define CVS_OP_EXPORT 9 |
#define CVS_OP_HISTORY 10 |
#define CVS_OP_HISTORY 10 |
#define CVS_OP_IMPORT 11 |
#define CVS_OP_IMPORT 11 |
#define CVS_OP_INIT 12 |
#define CVS_OP_INIT 12 |
#define CVS_OP_LOG 13 |
#define CVS_OP_LOG 13 |
#define CVS_OP_RANNOTATE 14 |
#define CVS_OP_RANNOTATE 14 |
#define CVS_OP_RDIFF 15 |
#define CVS_OP_RDIFF 15 |
#define CVS_OP_RELEASE 16 |
#define CVS_OP_RELEASE 16 |
#define CVS_OP_REMOVE 17 |
#define CVS_OP_REMOVE 17 |
#define CVS_OP_RLOG 18 |
#define CVS_OP_RLOG 18 |
#define CVS_OP_RTAG 19 |
#define CVS_OP_RTAG 19 |
#define CVS_OP_SERVER 20 |
#define CVS_OP_SERVER 20 |
#define CVS_OP_STATUS 21 |
#define CVS_OP_STATUS 21 |
#define CVS_OP_TAG 22 |
#define CVS_OP_TAG 22 |
#define CVS_OP_UNEDIT 23 |
#define CVS_OP_UNEDIT 23 |
#define CVS_OP_UPDATE 24 |
#define CVS_OP_UPDATE 24 |
#define CVS_OP_VERSION 25 |
#define CVS_OP_VERSION 25 |
#define CVS_OP_WATCH 26 |
#define CVS_OP_WATCH 26 |
#define CVS_OP_WATCHERS 27 |
#define CVS_OP_WATCHERS 27 |
|
|
#define CVS_OP_ANY 64 /* all operations */ |
#define CVS_OP_ANY 64 /* all operations */ |
|
|
|
|
/* methods */ |
/* methods */ |
#define CVS_METHOD_NONE 0 |
#define CVS_METHOD_NONE 0 |
#define CVS_METHOD_LOCAL 1 /* local access */ |
#define CVS_METHOD_LOCAL 1 /* local access */ |
#define CVS_METHOD_SERVER 2 /* tunnel through CVS_RSH */ |
#define CVS_METHOD_SERVER 2 /* tunnel through CVS_RSH */ |
#define CVS_METHOD_PSERVER 3 /* cvs pserver */ |
#define CVS_METHOD_PSERVER 3 /* cvs pserver */ |
#define CVS_METHOD_KSERVER 4 /* kerberos */ |
#define CVS_METHOD_KSERVER 4 /* kerberos */ |
#define CVS_METHOD_GSERVER 5 /* gssapi server */ |
#define CVS_METHOD_GSERVER 5 /* gssapi server */ |
#define CVS_METHOD_EXT 6 |
#define CVS_METHOD_EXT 6 |
#define CVS_METHOD_FORK 7 /* local but fork */ |
#define CVS_METHOD_FORK 7 /* local but fork */ |
|
|
#define CVS_CMD_MAXNAMELEN 16 |
#define CVS_CMD_MAXNAMELEN 16 |
#define CVS_CMD_MAXALIAS 2 |
#define CVS_CMD_MAXALIAS 2 |
#define CVS_CMD_MAXDESCRLEN 64 |
#define CVS_CMD_MAXDESCRLEN 64 |
#define CVS_CMD_MAXARG 128 |
#define CVS_CMD_MAXARG 128 |
|
|
|
|
/* defaults */ |
/* defaults */ |
#define CVS_SERVER_DEFAULT "cvs" |
#define CVS_SERVER_DEFAULT "cvs" |
#define CVS_RSH_DEFAULT "ssh" |
#define CVS_RSH_DEFAULT "ssh" |
#define CVS_EDITOR_DEFAULT "vi" |
#define CVS_EDITOR_DEFAULT "vi" |
|
|
/* extensions */ |
/* extensions */ |
#define CVS_DESCR_FILE_EXT ",t" |
#define CVS_DESCR_FILE_EXT ",t" |
|
|
/* server-side paths */ |
/* server-side paths */ |
#define CVS_PATH_ROOT "CVSROOT" |
#define CVS_PATH_ROOT "CVSROOT" |
#define CVS_PATH_EMPTYDIR CVS_PATH_ROOT "/Emptydir" |
#define CVS_PATH_EMPTYDIR CVS_PATH_ROOT "/Emptydir" |
#define CVS_PATH_COMMITINFO CVS_PATH_ROOT "/commitinfo" |
#define CVS_PATH_COMMITINFO CVS_PATH_ROOT "/commitinfo" |
#define CVS_PATH_CONFIG CVS_PATH_ROOT "/config" |
#define CVS_PATH_CONFIG CVS_PATH_ROOT "/config" |
#define CVS_PATH_CVSIGNORE CVS_PATH_ROOT "/cvsignore" |
#define CVS_PATH_CVSIGNORE CVS_PATH_ROOT "/cvsignore" |
#define CVS_PATH_CVSWRAPPERS CVS_PATH_ROOT "/cvswrappers" |
#define CVS_PATH_CVSWRAPPERS CVS_PATH_ROOT "/cvswrappers" |
#define CVS_PATH_EDITINFO CVS_PATH_ROOT "/editinfo" |
#define CVS_PATH_EDITINFO CVS_PATH_ROOT "/editinfo" |
#define CVS_PATH_HISTORY CVS_PATH_ROOT "/history" |
#define CVS_PATH_HISTORY CVS_PATH_ROOT "/history" |
#define CVS_PATH_LOGINFO CVS_PATH_ROOT "/loginfo" |
#define CVS_PATH_LOGINFO CVS_PATH_ROOT "/loginfo" |
#define CVS_PATH_MODULES CVS_PATH_ROOT "/modules" |
#define CVS_PATH_MODULES CVS_PATH_ROOT "/modules" |
#define CVS_PATH_NOTIFY CVS_PATH_ROOT "/notify" |
#define CVS_PATH_NOTIFY CVS_PATH_ROOT "/notify" |
#define CVS_PATH_RCSINFO CVS_PATH_ROOT "/rcsinfo" |
#define CVS_PATH_RCSINFO CVS_PATH_ROOT "/rcsinfo" |
#define CVS_PATH_TAGINFO CVS_PATH_ROOT "/taginfo" |
#define CVS_PATH_TAGINFO CVS_PATH_ROOT "/taginfo" |
#define CVS_PATH_VERIFYMSG CVS_PATH_ROOT "/verifymsg" |
#define CVS_PATH_VERIFYMSG CVS_PATH_ROOT "/verifymsg" |
|
|
|
|
/* client-side paths */ |
/* client-side paths */ |
#define CVS_PATH_RC ".cvsrc" |
#define CVS_PATH_RC ".cvsrc" |
#define CVS_PATH_CVSDIR "CVS" |
#define CVS_PATH_CVSDIR "CVS" |
#define CVS_PATH_ENTRIES CVS_PATH_CVSDIR "/Entries" |
#define CVS_PATH_ENTRIES CVS_PATH_CVSDIR "/Entries" |
#define CVS_PATH_STATICENTRIES CVS_PATH_CVSDIR "/Entries.Static" |
#define CVS_PATH_STATICENTRIES CVS_PATH_CVSDIR "/Entries.Static" |
#define CVS_PATH_LOGENTRIES CVS_PATH_CVSDIR "/Entries.Log" |
#define CVS_PATH_LOGENTRIES CVS_PATH_CVSDIR "/Entries.Log" |
#define CVS_PATH_ROOTSPEC CVS_PATH_CVSDIR "/Root" |
#define CVS_PATH_ROOTSPEC CVS_PATH_CVSDIR "/Root" |
#define CVS_PATH_REPOSITORY CVS_PATH_CVSDIR "/Repository" |
#define CVS_PATH_REPOSITORY CVS_PATH_CVSDIR "/Repository" |
|
|
|
|
/* flags for cmd_flags */ |
/* flags for cmd_flags */ |
|
|
}; |
}; |
|
|
|
|
#define CVS_ROOT_CONNECTED 0x01 |
#define CVS_ROOT_CONNECTED 0x01 |
|
|
struct cvsroot { |
struct cvsroot { |
char *cr_str; |
char *cr_str; |
|
|
u_char cr_vrmask[16]; /* mask of valid requests supported by server */ |
u_char cr_vrmask[16]; /* mask of valid requests supported by server */ |
}; |
}; |
|
|
#define CVS_SETVR(rt, rq) ((rt)->cr_vrmask[(rq) / 8] |= (1 << ((rq) % 8))) |
#define CVS_SETVR(rt, rq) ((rt)->cr_vrmask[(rq) / 8] |= (1 << ((rq) % 8))) |
#define CVS_GETVR(rt, rq) ((rt)->cr_vrmask[(rq) / 8] & (1 << ((rq) % 8))) |
#define CVS_GETVR(rt, rq) ((rt)->cr_vrmask[(rq) / 8] & (1 << ((rq) % 8))) |
#define CVS_CLRVR(rt, rq) ((rt)->cr_vrmask[(rq) / 8] &= ~(1 << ((rq) % 8))) |
#define CVS_CLRVR(rt, rq) ((rt)->cr_vrmask[(rq) / 8] &= ~(1 << ((rq) % 8))) |
#define CVS_RSTVR(rt) memset((rt)->cr_vrmask, 0, sizeof((rt)->cr_vrmask)) |
#define CVS_RSTVR(rt) memset((rt)->cr_vrmask, 0, sizeof((rt)->cr_vrmask)) |
|
|
|
|
#define CVS_HIST_ADDED 'A' |
#define CVS_HIST_ADDED 'A' |
#define CVS_HIST_EXPORT 'E' |
#define CVS_HIST_EXPORT 'E' |
#define CVS_HIST_RELEASE 'F' |
#define CVS_HIST_RELEASE 'F' |
#define CVS_HIST_MODIFIED 'M' |
#define CVS_HIST_MODIFIED 'M' |
#define CVS_HIST_CHECKOUT 'O' |
#define CVS_HIST_CHECKOUT 'O' |
#define CVS_HIST_COMMIT 'R' |
#define CVS_HIST_COMMIT 'R' |
#define CVS_HIST_TAG 'T' |
#define CVS_HIST_TAG 'T' |
|
|
|
|
#define CVS_DATE_DUMMY "dummy timestamp" |
#define CVS_DATE_DUMMY "dummy timestamp" |
#define CVS_DATE_DMSEC (time_t)-1 |
#define CVS_DATE_DMSEC (time_t)-1 |
|
|
#define CVS_ENT_NONE 0 |
#define CVS_ENT_NONE 0 |
#define CVS_ENT_FILE 1 |
#define CVS_ENT_FILE 1 |
#define CVS_ENT_DIR 2 |
#define CVS_ENT_DIR 2 |
|
|
#define CVS_ENT_REG 0 |
#define CVS_ENT_REG 0 |
#define CVS_ENT_ADDED 1 |
#define CVS_ENT_ADDED 1 |
#define CVS_ENT_REMOVED 2 |
#define CVS_ENT_REMOVED 2 |
#define CVS_ENT_UPTODATE 3 |
#define CVS_ENT_UPTODATE 3 |
|
|
#define CVS_ENTF_SYNC 0x01 /* contents of disk and memory match */ |
#define CVS_ENTF_SYNC 0x01 /* contents of disk and memory match */ |
#define CVS_ENTF_WR 0x02 /* file is opened for writing too */ |
#define CVS_ENTF_WR 0x02 /* file is opened for writing too */ |
|
|
|
|
struct cvs_ent { |
struct cvs_ent { |
char *ce_buf; |
char *ce_buf; |
u_int16_t ce_type; |
u_int16_t ce_type; |
u_int16_t ce_status; |
u_int16_t ce_status; |
char *ce_name; |
char *ce_name; |
RCSNUM *ce_rev; |
RCSNUM *ce_rev; |
time_t ce_mtime; |
time_t ce_mtime; |
char *ce_opts; |
char *ce_opts; |
char *ce_tag; |
char *ce_tag; |
TAILQ_ENTRY(cvs_ent) ce_list; |
TAILQ_ENTRY(cvs_ent) ce_list; |
}; |
}; |
|
|
typedef struct cvs_entries { |
typedef struct cvs_entries { |
char *cef_path; |
char *cef_path; |
u_int cef_flags; |
u_int cef_flags; |
|
|
TAILQ_HEAD(, cvs_ent) cef_ent; |
TAILQ_HEAD(, cvs_ent) cef_ent; |
struct cvs_ent *cef_cur; |
struct cvs_ent *cef_cur; |
} CVSENTRIES; |
} CVSENTRIES; |
|
|
|
|
struct cvs_hent { |
struct cvs_hent { |
char ch_event; |
char ch_event; |
time_t ch_date; |
time_t ch_date; |
uid_t ch_uid; |
uid_t ch_uid; |
char *ch_user; |
char *ch_user; |
char *ch_curdir; |
char *ch_curdir; |
char *ch_repo; |
char *ch_repo; |
RCSNUM *ch_rev; |
RCSNUM *ch_rev; |
char *ch_arg; |
char *ch_arg; |
}; |
}; |
|
|
|
|
typedef struct cvs_histfile { |
typedef struct cvs_histfile { |
int chf_fd; |
int chf_fd; |
char *chf_buf; /* read buffer */ |
char *chf_buf; /* read buffer */ |
size_t chf_blen; /* buffer size */ |
size_t chf_blen; /* buffer size */ |
size_t chf_bused; /* bytes used in buffer */ |
size_t chf_bused; /* bytes used in buffer */ |
|
|
off_t chf_off; /* next read */ |
off_t chf_off; /* next read */ |
u_int chf_sindex; /* history entry index of first in array */ |
u_int chf_sindex; /* history entry index of first in array */ |
u_int chf_cindex; /* current index (for getnext()) */ |
u_int chf_cindex; /* current index (for getnext()) */ |
u_int chf_nbhent; /* number of valid entries in the array */ |
u_int chf_nbhent; /* number of valid entries in the array */ |
|
|
struct cvs_hent chf_hent[CVS_HIST_CACHE]; |
struct cvs_hent chf_hent[CVS_HIST_CACHE]; |
|
|
} CVSHIST; |
} CVSHIST; |
|
|
|
|
extern struct cvs_cmd cvs_cmd_watchers; |
extern struct cvs_cmd cvs_cmd_watchers; |
|
|
|
|
struct cvs_cmd* cvs_findcmd (const char *); |
struct cvs_cmd *cvs_findcmd(const char *); |
struct cvs_cmd* cvs_findcmdbyreq (int); |
struct cvs_cmd *cvs_findcmdbyreq(int); |
int cvs_startcmd (struct cvs_cmd *, int, char **); |
int cvs_startcmd(struct cvs_cmd *, int, char **); |
int cvs_server (int, char **); |
int cvs_server(int, char **); |
|
|
int cvs_var_set (const char *, const char *); |
int cvs_var_set(const char *, const char *); |
int cvs_var_unset (const char *); |
int cvs_var_unset(const char *); |
const char* cvs_var_get (const char *); |
const char *cvs_var_get(const char *); |
|
|
|
|
/* root.c */ |
/* root.c */ |
struct cvsroot* cvsroot_parse (const char *); |
struct cvsroot *cvsroot_parse(const char *); |
void cvsroot_free (struct cvsroot *); |
void cvsroot_free(struct cvsroot *); |
struct cvsroot* cvsroot_get (const char *); |
struct cvsroot *cvsroot_get(const char *); |
|
|
|
|
/* Entries API */ |
/* Entries API */ |
CVSENTRIES* cvs_ent_open (const char *, int); |
CVSENTRIES *cvs_ent_open(const char *, int); |
struct cvs_ent* cvs_ent_get (CVSENTRIES *, const char *); |
struct cvs_ent *cvs_ent_get(CVSENTRIES *, const char *); |
struct cvs_ent* cvs_ent_next (CVSENTRIES *); |
struct cvs_ent *cvs_ent_next(CVSENTRIES *); |
int cvs_ent_add (CVSENTRIES *, struct cvs_ent *); |
int cvs_ent_add(CVSENTRIES *, struct cvs_ent *); |
int cvs_ent_addln (CVSENTRIES *, const char *); |
int cvs_ent_addln(CVSENTRIES *, const char *); |
int cvs_ent_remove (CVSENTRIES *, const char *); |
int cvs_ent_remove(CVSENTRIES *, const char *); |
int cvs_ent_write (CVSENTRIES *); |
int cvs_ent_write(CVSENTRIES *); |
struct cvs_ent* cvs_ent_parse (const char *); |
struct cvs_ent *cvs_ent_parse(const char *); |
void cvs_ent_close (CVSENTRIES *); |
void cvs_ent_close(CVSENTRIES *); |
void cvs_ent_free (struct cvs_ent *); |
void cvs_ent_free(struct cvs_ent *); |
|
|
/* history API */ |
/* history API */ |
CVSHIST* cvs_hist_open (const char *); |
CVSHIST *cvs_hist_open(const char *); |
void cvs_hist_close (CVSHIST *); |
void cvs_hist_close(CVSHIST *); |
int cvs_hist_parse (CVSHIST *); |
int cvs_hist_parse(CVSHIST *); |
struct cvs_hent* cvs_hist_getnext (CVSHIST *); |
struct cvs_hent *cvs_hist_getnext(CVSHIST *); |
int cvs_hist_append (CVSHIST *, struct cvs_hent *); |
int cvs_hist_append(CVSHIST *, struct cvs_hent *); |
|
|
/* logmsg.c */ |
/* logmsg.c */ |
char* cvs_logmsg_open (const char *); |
char *cvs_logmsg_open(const char *); |
char* cvs_logmsg_get (const char *, struct cvs_flist *, struct cvs_flist *, struct cvs_flist *); |
char *cvs_logmsg_get(const char *, struct cvs_flist *, |
int cvs_logmsg_send (struct cvsroot *, const char *); |
struct cvs_flist *, struct cvs_flist *); |
|
int cvs_logmsg_send(struct cvsroot *, const char *); |
|
|
/* date.y */ |
/* date.y */ |
time_t cvs_date_parse (const char *); |
time_t cvs_date_parse(const char *); |
|
|
/* util.c */ |
/* util.c */ |
int cvs_readrepo (const char *, char *, size_t); |
int cvs_readrepo(const char *, char *, size_t); |
int cvs_modetostr (mode_t, char *, size_t); |
int cvs_modetostr(mode_t, char *, size_t); |
int cvs_strtomode (const char *, mode_t *); |
int cvs_strtomode(const char *, mode_t *); |
int cvs_splitpath (const char *, char *, size_t, char **); |
int cvs_splitpath(const char *, char *, size_t, char **); |
int cvs_mkadmin (const char *, const char *, const char *); |
int cvs_mkadmin(const char *, const char *, const char *); |
int cvs_cksum (const char *, char *, size_t); |
int cvs_cksum(const char *, char *, size_t); |
int cvs_exec (int, char **, int []); |
int cvs_exec(int, char **, int []); |
int cvs_getargv (const char *, char **, int); |
int cvs_getargv(const char *, char **, int); |
int cvs_chdir (const char *); |
int cvs_chdir(const char *); |
int cvs_unlink (const char *); |
int cvs_unlink(const char *); |
int cvs_remove_dir (const char *); |
int cvs_remove_dir(const char *); |
int cvs_create_dir (const char *, int, char *, char *); |
int cvs_create_dir(const char *, int, char *, char *); |
char* cvs_rcs_getpath (CVSFILE *, char *, size_t); |
char *cvs_rcs_getpath(CVSFILE *, char *, size_t); |
char** cvs_makeargv (const char *, int *); |
char **cvs_makeargv(const char *, int *); |
void cvs_freeargv (char **, int); |
void cvs_freeargv(char **, int); |
size_t cvs_path_cat (const char *, const char *, char *, size_t); |
size_t cvs_path_cat(const char *, const char *, char *, size_t); |
|
|
|
|
#endif /* CVS_H */ |
#endif /* CVS_H */ |