version 1.38, 2004/12/06 21:03:12 |
version 1.39, 2004/12/07 17:10:56 |
|
|
/* |
/* |
* Standard patterns to ignore. |
* Standard patterns to ignore. |
*/ |
*/ |
|
|
static const char *cvs_ign_std[] = { |
static const char *cvs_ign_std[] = { |
".", |
".", |
"..", |
"..", |
|
|
* Filename hash table used to avoid duplication of name strings when working |
* Filename hash table used to avoid duplication of name strings when working |
* on large source trees with common parts. |
* on large source trees with common parts. |
*/ |
*/ |
|
|
SLIST_HEAD(cvs_fhb, cvs_fname); |
SLIST_HEAD(cvs_fhb, cvs_fname); |
|
|
static struct cvs_fhb cvs_fnht[CVS_FILE_NBUCKETS]; |
static struct cvs_fhb cvs_fnht[CVS_FILE_NBUCKETS]; |
|
|
* cvs_file_init() |
* cvs_file_init() |
* |
* |
*/ |
*/ |
|
|
int |
int |
cvs_file_init(void) |
cvs_file_init(void) |
{ |
{ |
|
|
* Add the pattern <pat> to the list of patterns for files to ignore. |
* Add the pattern <pat> to the list of patterns for files to ignore. |
* Returns 0 on success, or -1 on failure. |
* Returns 0 on success, or -1 on failure. |
*/ |
*/ |
|
|
int |
int |
cvs_file_ignore(const char *pat) |
cvs_file_ignore(const char *pat) |
{ |
{ |
|
|
* Returns 1 if the filename <file> is matched by one of the ignore |
* Returns 1 if the filename <file> is matched by one of the ignore |
* patterns, or 0 otherwise. |
* patterns, or 0 otherwise. |
*/ |
*/ |
|
|
int |
int |
cvs_file_chkign(const char *file) |
cvs_file_chkign(const char *file) |
{ |
{ |
|
|
* created. |
* created. |
* Returns the created file on success, or NULL on failure. |
* Returns the created file on success, or NULL on failure. |
*/ |
*/ |
|
|
CVSFILE* |
CVSFILE* |
cvs_file_create(CVSFILE *parent, const char *path, u_int type, mode_t mode) |
cvs_file_create(CVSFILE *parent, const char *path, u_int type, mode_t mode) |
{ |
{ |
|
|
* Returns the copied file on success, or NULL on failure. The returned |
* Returns the copied file on success, or NULL on failure. The returned |
* structure should be freed using cvs_file_free(). |
* structure should be freed using cvs_file_free(). |
*/ |
*/ |
|
|
CVSFILE* |
CVSFILE* |
cvs_file_copy(CVSFILE *orig) |
cvs_file_copy(CVSFILE *orig) |
{ |
{ |
|
|
* Returns a pointer to the lowest common subdirectory to all specified |
* Returns a pointer to the lowest common subdirectory to all specified |
* files. |
* files. |
*/ |
*/ |
|
|
CVSFILE* |
CVSFILE* |
cvs_file_getspec(char **fspec, int fsn, int flags) |
cvs_file_getspec(char **fspec, int fsn, int flags) |
{ |
{ |
|
|
* The file's pathname <path> must be relative to the base of <hier>. |
* The file's pathname <path> must be relative to the base of <hier>. |
* Returns the entry on success, or NULL on failure. |
* Returns the entry on success, or NULL on failure. |
*/ |
*/ |
|
|
CVSFILE* |
CVSFILE* |
cvs_file_find(CVSFILE *hier, const char *path) |
cvs_file_find(CVSFILE *hier, const char *path) |
{ |
{ |
|
|
* at least MAXPATHLEN bytes long. |
* at least MAXPATHLEN bytes long. |
* Returns a pointer to the start of the path on success, or NULL on failure. |
* Returns a pointer to the start of the path on success, or NULL on failure. |
*/ |
*/ |
|
|
char* |
char* |
cvs_file_getpath(CVSFILE *file, char *buf, size_t len) |
cvs_file_getpath(CVSFILE *file, char *buf, size_t len) |
{ |
{ |
|
|
* has to be a file of type DT_DIR. |
* has to be a file of type DT_DIR. |
* Returns 0 on success, or -1 on failure. |
* Returns 0 on success, or -1 on failure. |
*/ |
*/ |
|
|
int |
int |
cvs_file_attach(CVSFILE *parent, CVSFILE *file) |
cvs_file_attach(CVSFILE *parent, CVSFILE *file) |
{ |
{ |
|
|
* This function should not free the directory information on error, as this |
* This function should not free the directory information on error, as this |
* is performed by cvs_file_free(). |
* is performed by cvs_file_free(). |
*/ |
*/ |
|
|
static int |
static int |
cvs_file_getdir(CVSFILE *cf, int flags) |
cvs_file_getdir(CVSFILE *cf, int flags) |
{ |
{ |
|
|
* |
* |
* Free a cvs_file structure and its contents. |
* Free a cvs_file structure and its contents. |
*/ |
*/ |
|
|
void |
void |
cvs_file_free(CVSFILE *cf) |
cvs_file_free(CVSFILE *cf) |
{ |
{ |
|
|
* <exam>. The function is called for all subdirectories and files of the |
* <exam>. The function is called for all subdirectories and files of the |
* root file. |
* root file. |
*/ |
*/ |
|
|
int |
int |
cvs_file_examine(CVSFILE *cf, int (*exam)(CVSFILE *, void *), void *arg) |
cvs_file_examine(CVSFILE *cf, int (*exam)(CVSFILE *, void *), void *arg) |
{ |
{ |
|
|
* |
* |
* Free a cvs_dir structure and its contents. |
* Free a cvs_dir structure and its contents. |
*/ |
*/ |
|
|
static void |
static void |
cvs_file_freedir(struct cvs_dir *cd) |
cvs_file_freedir(struct cvs_dir *cd) |
{ |
{ |
|
|
* in the list must be given by <nfiles>. |
* in the list must be given by <nfiles>. |
* Returns 0 on success, or -1 on failure. |
* Returns 0 on success, or -1 on failure. |
*/ |
*/ |
|
|
static int |
static int |
cvs_file_sort(struct cvs_flist *flp, u_int nfiles) |
cvs_file_sort(struct cvs_flist *flp, u_int nfiles) |
{ |
{ |
|
|
* |
* |
* Allocate a CVSFILE structure and initialize its internals. |
* Allocate a CVSFILE structure and initialize its internals. |
*/ |
*/ |
|
|
CVSFILE* |
CVSFILE* |
cvs_file_alloc(const char *path, u_int type) |
cvs_file_alloc(const char *path, u_int type) |
{ |
{ |
|
|
* Returns a pointer to the created file structure on success, or NULL on |
* Returns a pointer to the created file structure on success, or NULL on |
* failure. |
* failure. |
*/ |
*/ |
|
|
static CVSFILE* |
static CVSFILE* |
cvs_file_lget(const char *path, int flags, CVSFILE *parent) |
cvs_file_lget(const char *path, int flags, CVSFILE *parent) |
{ |
{ |
|
|
* Generate an 8 bit hash value from the name of a file. |
* Generate an 8 bit hash value from the name of a file. |
* XXX Improve my distribution! |
* XXX Improve my distribution! |
*/ |
*/ |
|
|
static u_int8_t |
static u_int8_t |
cvs_file_hashname(const char *name) |
cvs_file_hashname(const char *name) |
{ |
{ |
|
|
* If no entry is found for that name, a new one is created and inserted into |
* If no entry is found for that name, a new one is created and inserted into |
* the table. The name's reference count is increased. |
* the table. The name's reference count is increased. |
*/ |
*/ |
|
|
static struct cvs_fname* |
static struct cvs_fname* |
cvs_file_getname(const char *name) |
cvs_file_getname(const char *name) |
{ |
{ |