version 1.29, 2005/05/26 01:45:54 |
version 1.30, 2005/07/25 11:28:59 |
|
|
|
|
#include "buf.h" |
#include "buf.h" |
|
|
#define RCS_DIFF_MAXARG 32 |
#define RCS_DIFF_MAXARG 32 |
#define RCS_DIFF_DIV \ |
#define RCS_DIFF_DIV \ |
"===================================================================" |
"===================================================================" |
|
|
#define RCSDIR "RCS" |
#define RCSDIR "RCS" |
#define RCS_FILE_EXT ",v" |
#define RCS_FILE_EXT ",v" |
|
|
#define RCS_HEAD_BRANCH "HEAD" |
#define RCS_HEAD_BRANCH "HEAD" |
#define RCS_HEAD_INIT "1.1" |
#define RCS_HEAD_INIT "1.1" |
#define RCS_HEAD_REV ((RCSNUM *)(-1)) |
#define RCS_HEAD_REV ((RCSNUM *)(-1)) |
|
|
|
|
#define RCS_SYM_INVALCHAR "$,.:;@" |
#define RCS_SYM_INVALCHAR "$,.:;@" |
|
|
|
|
#define RCS_STATE_EXP "Exp" |
#define RCS_STATE_EXP "Exp" |
#define RCS_STATE_DEAD "dead" |
#define RCS_STATE_DEAD "dead" |
|
|
/* lock types */ |
/* lock types */ |
#define RCS_LOCK_INVAL (-1) |
#define RCS_LOCK_INVAL (-1) |
#define RCS_LOCK_LOOSE 0 |
#define RCS_LOCK_LOOSE 0 |
#define RCS_LOCK_STRICT 1 |
#define RCS_LOCK_STRICT 1 |
|
|
|
|
/* RCS keyword expansion modes (kflags) */ |
/* RCS keyword expansion modes (kflags) */ |
#define RCS_KWEXP_NONE 0x00 |
#define RCS_KWEXP_NONE 0x00 |
#define RCS_KWEXP_NAME 0x01 /* include keyword name */ |
#define RCS_KWEXP_NAME 0x01 /* include keyword name */ |
#define RCS_KWEXP_VAL 0x02 /* include keyword value */ |
#define RCS_KWEXP_VAL 0x02 /* include keyword value */ |
#define RCS_KWEXP_LKR 0x04 /* include name of locker */ |
#define RCS_KWEXP_LKR 0x04 /* include name of locker */ |
#define RCS_KWEXP_OLD 0x08 /* generate old keyword string */ |
#define RCS_KWEXP_OLD 0x08 /* generate old keyword string */ |
#define RCS_KWEXP_ERR 0x10 /* mode has an error */ |
#define RCS_KWEXP_ERR 0x10 /* mode has an error */ |
|
|
#define RCS_KWEXP_DEFAULT (RCS_KWEXP_NAME | RCS_KWEXP_VAL) |
#define RCS_KWEXP_DEFAULT (RCS_KWEXP_NAME | RCS_KWEXP_VAL) |
#define RCS_KWEXP_KVL (RCS_KWEXP_NAME | RCS_KWEXP_VAL | RCS_KWEXP_LKR) |
#define RCS_KWEXP_KVL (RCS_KWEXP_NAME | RCS_KWEXP_VAL | RCS_KWEXP_LKR) |
|
|
#define RCS_KWEXP_INVAL(k) \ |
#define RCS_KWEXP_INVAL(k) \ |
((k & RCS_KWEXP_ERR) || \ |
((k & RCS_KWEXP_ERR) || \ |
|
|
|
|
|
|
|
|
#define RCSNUM_MAXNUM USHRT_MAX |
#define RCSNUM_MAXNUM USHRT_MAX |
#define RCSNUM_MAXLEN 64 |
#define RCSNUM_MAXLEN 64 |
|
|
#define RCSNUM_ISBRANCH(n) ((n)->rn_len % 2) |
#define RCSNUM_ISBRANCH(n) ((n)->rn_len % 2) |
|
|
|
|
/* file flags */ |
/* file flags */ |
#define RCS_READ 0x01 |
#define RCS_READ 0x01 |
#define RCS_WRITE 0x02 |
#define RCS_WRITE 0x02 |
#define RCS_RDWR (RCS_READ|RCS_WRITE) |
#define RCS_RDWR (RCS_READ|RCS_WRITE) |
#define RCS_CREATE 0x04 /* create the file */ |
#define RCS_CREATE 0x04 /* create the file */ |
|
|
/* internal flags */ |
/* internal flags */ |
#define RCS_PARSED 0x010000 /* file has been parsed */ |
#define RCS_PARSED 0x010000 /* file has been parsed */ |
#define RCS_SYNCED 0x020000 /* in-memory copy is in sync with disk copy */ |
#define RCS_SYNCED 0x020000 /* in-mem copy is sync with disk copy */ |
#define RCS_SLOCK 0x040000 /* strict lock */ |
#define RCS_SLOCK 0x040000 /* strict lock */ |
|
|
/* delta flags */ |
/* delta flags */ |
#define RCS_RD_DEAD 0x01 /* dead */ |
#define RCS_RD_DEAD 0x01 /* dead */ |
|
|
/* RCS error codes */ |
/* RCS error codes */ |
#define RCS_ERR_NOERR 0 |
#define RCS_ERR_NOERR 0 |
#define RCS_ERR_NOENT 1 |
#define RCS_ERR_NOENT 1 |
#define RCS_ERR_DUPENT 2 |
#define RCS_ERR_DUPENT 2 |
#define RCS_ERR_BADNUM 3 |
#define RCS_ERR_BADNUM 3 |
#define RCS_ERR_BADSYM 4 |
#define RCS_ERR_BADSYM 4 |
#define RCS_ERR_PARSE 5 |
#define RCS_ERR_PARSE 5 |
#define RCS_ERR_ERRNO 255 |
#define RCS_ERR_ERRNO 255 |
|
|
typedef struct rcs_num { |
typedef struct rcs_num { |
u_int rn_len; |
u_int rn_len; |
u_int16_t *rn_id; |
u_int16_t *rn_id; |
} RCSNUM; |
} RCSNUM; |
|
|
|
|
struct rcs_access { |
struct rcs_access { |
char *ra_name; |
char *ra_name; |
uid_t ra_uid; |
uid_t ra_uid; |
TAILQ_ENTRY(rcs_access) ra_list; |
TAILQ_ENTRY(rcs_access) ra_list; |
}; |
}; |
|
|
struct rcs_sym { |
struct rcs_sym { |
char *rs_name; |
char *rs_name; |
RCSNUM *rs_num; |
RCSNUM *rs_num; |
TAILQ_ENTRY(rcs_sym) rs_list; |
TAILQ_ENTRY(rcs_sym) rs_list; |
}; |
}; |
|
|
struct rcs_lock { |
struct rcs_lock { |
char *rl_name; |
char *rl_name; |
RCSNUM *rl_num; |
RCSNUM *rl_num; |
|
|
TAILQ_ENTRY(rcs_lock) rl_list; |
TAILQ_ENTRY(rcs_lock) rl_list; |
}; |
}; |
|
|
|
|
struct rcs_branch { |
struct rcs_branch { |
RCSNUM *rb_num; |
RCSNUM *rb_num; |
TAILQ_ENTRY(rcs_branch) rb_list; |
TAILQ_ENTRY(rcs_branch) rb_list; |
}; |
}; |
|
|
struct rcs_dlist { |
struct rcs_dlist { |
struct rcs_delta *tqh_first; |
struct rcs_delta *tqh_first; |
struct rcs_delta **tqh_last; |
struct rcs_delta **tqh_last; |
}; |
}; |
|
|
struct rcs_delta { |
struct rcs_delta { |
RCSNUM *rd_num; |
RCSNUM *rd_num; |
RCSNUM *rd_next; |
RCSNUM *rd_next; |
u_int rd_flags; |
u_int rd_flags; |
struct tm rd_date; |
struct tm rd_date; |
char *rd_author; |
char *rd_author; |
char *rd_state; |
char *rd_state; |
char *rd_log; |
char *rd_log; |
u_char *rd_text; |
u_char *rd_text; |
size_t rd_tlen; |
size_t rd_tlen; |
|
|
struct rcs_dlist rd_snodes; |
struct rcs_dlist rd_snodes; |
TAILQ_HEAD(, rcs_branch) rd_branches; |
TAILQ_HEAD(, rcs_branch) rd_branches; |
TAILQ_ENTRY(rcs_delta) rd_list; |
TAILQ_ENTRY(rcs_delta) rd_list; |
}; |
}; |
|
|
|
|
typedef struct rcs_file { |
typedef struct rcs_file { |
char *rf_path; |
char *rf_path; |
u_int rf_ref; |
u_int rf_ref; |
mode_t rf_mode; |
mode_t rf_mode; |
u_int rf_flags; |
u_int rf_flags; |
|
|
RCSNUM *rf_head; |
RCSNUM *rf_head; |
RCSNUM *rf_branch; |
RCSNUM *rf_branch; |
char *rf_comment; |
char *rf_comment; |
char *rf_expand; |
char *rf_expand; |
char *rf_desc; |
char *rf_desc; |
|
|
u_int rf_ndelta; |
u_int rf_ndelta; |
struct rcs_dlist rf_delta; |
struct rcs_dlist rf_delta; |
TAILQ_HEAD(rcs_alist, rcs_access) rf_access; |
TAILQ_HEAD(rcs_alist, rcs_access) rf_access; |
TAILQ_HEAD(rcs_slist, rcs_sym) rf_symbols; |
TAILQ_HEAD(rcs_slist, rcs_sym) rf_symbols; |
TAILQ_HEAD(rcs_llist, rcs_lock) rf_locks; |
TAILQ_HEAD(rcs_llist, rcs_lock) rf_locks; |
|
|
void *rf_pdata; |
void *rf_pdata; |
} RCSFILE; |
} RCSFILE; |
|
|
|
|
extern int rcs_errno; |
extern int rcs_errno; |
|
|
|
|
RCSFILE* rcs_open (const char *, int, ...); |
RCSFILE *rcs_open(const char *, int, ...); |
void rcs_close (RCSFILE *); |
void rcs_close(RCSFILE *); |
const RCSNUM* rcs_head_get (RCSFILE *); |
const RCSNUM *rcs_head_get(RCSFILE *); |
int rcs_head_set (RCSFILE *, const RCSNUM *); |
int rcs_head_set(RCSFILE *, const RCSNUM *); |
const RCSNUM* rcs_branch_get (RCSFILE *); |
const RCSNUM *rcs_branch_get(RCSFILE *); |
int rcs_branch_set (RCSFILE *, const RCSNUM *); |
int rcs_branch_set(RCSFILE *, const RCSNUM *); |
int rcs_access_add (RCSFILE *, const char *); |
int rcs_access_add(RCSFILE *, const char *); |
int rcs_access_remove (RCSFILE *, const char *); |
int rcs_access_remove(RCSFILE *, const char *); |
int rcs_access_check (RCSFILE *, const char *); |
int rcs_access_check(RCSFILE *, const char *); |
int rcs_sym_add (RCSFILE *, const char *, RCSNUM *); |
int rcs_sym_add(RCSFILE *, const char *, RCSNUM *); |
int rcs_sym_remove (RCSFILE *, const char *); |
int rcs_sym_remove(RCSFILE *, const char *); |
RCSNUM* rcs_sym_getrev (RCSFILE *, const char *); |
RCSNUM *rcs_sym_getrev(RCSFILE *, const char *); |
int rcs_sym_check (const char *); |
int rcs_sym_check(const char *); |
int rcs_lock_getmode (RCSFILE *); |
int rcs_lock_getmode(RCSFILE *); |
int rcs_lock_setmode (RCSFILE *, int); |
int rcs_lock_setmode(RCSFILE *, int); |
int rcs_lock_add (RCSFILE *, const char *, RCSNUM *); |
int rcs_lock_add(RCSFILE *, const char *, RCSNUM *); |
int rcs_lock_remove (RCSFILE *, const RCSNUM *); |
int rcs_lock_remove(RCSFILE *, const RCSNUM *); |
BUF* rcs_getrev (RCSFILE *, RCSNUM *); |
BUF *rcs_getrev(RCSFILE *, RCSNUM *); |
const char* rcs_desc_get (RCSFILE *); |
const char *rcs_desc_get(RCSFILE *); |
int rcs_desc_set (RCSFILE *, const char *); |
int rcs_desc_set(RCSFILE *, const char *); |
const char* rcs_comment_lookup(const char *); |
const char *rcs_comment_lookup(const char *); |
const char* rcs_comment_get (RCSFILE *); |
const char *rcs_comment_get(RCSFILE *); |
int rcs_comment_set (RCSFILE *, const char *); |
int rcs_comment_set(RCSFILE *, const char *); |
int rcs_kwexp_set (RCSFILE *, int); |
int rcs_kwexp_set(RCSFILE *, int); |
int rcs_kwexp_get (RCSFILE *); |
int rcs_kwexp_get(RCSFILE *); |
int rcs_rev_add (RCSFILE *, RCSNUM *, const char *, time_t); |
int rcs_rev_add(RCSFILE *, RCSNUM *, const char *, time_t); |
int rcs_rev_remove (RCSFILE *, RCSNUM *); |
int rcs_rev_remove(RCSFILE *, RCSNUM *); |
RCSNUM* rcs_tag_resolve (RCSFILE *, const char *); |
RCSNUM *rcs_tag_resolve(RCSFILE *, const char *); |
const char* rcs_errstr (int); |
const char *rcs_errstr(int); |
|
|
|
|
int rcs_kflag_get (const char *); |
int rcs_kflag_get(const char *); |
void rcs_kflag_usage (void); |
void rcs_kflag_usage(void); |
int rcs_kw_expand (RCSFILE *, u_char *, size_t, size_t *); |
int rcs_kw_expand(RCSFILE *, u_char *, size_t, size_t *); |
|
|
BUF* rcs_patch (const char *, const char *); |
BUF *rcs_patch(const char *, const char *); |
|
|
RCSNUM* rcsnum_alloc (void); |
RCSNUM *rcsnum_alloc(void); |
RCSNUM* rcsnum_parse (const char *); |
RCSNUM *rcsnum_parse(const char *); |
RCSNUM* rcsnum_brtorev(const RCSNUM *); |
RCSNUM *rcsnum_brtorev(const RCSNUM *); |
RCSNUM* rcsnum_revtobr(const RCSNUM *); |
RCSNUM *rcsnum_revtobr(const RCSNUM *); |
RCSNUM* rcsnum_inc (RCSNUM *); |
RCSNUM *rcsnum_inc(RCSNUM *); |
void rcsnum_free (RCSNUM *); |
void rcsnum_free(RCSNUM *); |
int rcsnum_aton (const char *, char **, RCSNUM *); |
int rcsnum_aton(const char *, char **, RCSNUM *); |
char* rcsnum_tostr (const RCSNUM *, char *, size_t); |
char *rcsnum_tostr(const RCSNUM *, char *, size_t); |
int rcsnum_cpy (const RCSNUM *, RCSNUM *, u_int); |
int rcsnum_cpy(const RCSNUM *, RCSNUM *, u_int); |
int rcsnum_cmp (const RCSNUM *, const RCSNUM *, u_int); |
int rcsnum_cmp(const RCSNUM *, const RCSNUM *, u_int); |
|
|
#endif /* RCS_H */ |
#endif /* RCS_H */ |