2 * Copyright (c) 1992, Brian Berliner and Jeff Polk
3 * Copyright (c) 1989-1992, Brian Berliner
5 * You may distribute under the terms of the GNU General Public License as
6 * specified in the README file that comes with the CVS kit.
10 * basic information used in all source files
15 #include "config.h" /* this is stuff found via autoconf */
16 #include "options.h" /* these are some larger questions which
17 can't easily be automatically checked
20 /* Changed from if __STDC__ to ifdef __STDC__ because of Sun's acc compiler */
28 /* Add prototype support. */
30 #if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
31 #define PROTO(ARGS) ARGS
33 #define PROTO(ARGS) ()
39 /* Under OS/2, <stdio.h> doesn't define popen()/pclose(). */
48 extern char *getenv();
62 /* If the system doesn't provide strerror, it won't be declared in
67 #include <fnmatch.h> /* This is supposed to be available on Posix systems */
79 #endif /* HAVE_ERRNO_H */
84 #if defined(SERVER_SUPPORT) || defined(CLIENT_SUPPORT)
101 /* This actually gets set in system.h. Note that the _ONLY_ reason for
102 this is if various system calls (getwd, getcwd, readlink) require/want
103 us to use it. All other parts of CVS allocate pathname buffers
104 dynamically, and we want to keep it that way. */
107 #define PATH_MAX MAXPATHLEN+2
109 #define PATH_MAX 1024+2
111 #endif /* PATH_MAX */
113 /* Definitions for the CVS Administrative directory and the files it contains.
114 Here as #define's to make changing the names a simple task. */
116 #ifdef USE_VMS_FILENAMES
118 #define CVSADM_ENT "CVS/Entries."
119 #define CVSADM_ENTBAK "CVS/Entries.Backup"
120 #define CVSADM_ENTLOG "CVS/Entries.Log"
121 #define CVSADM_ENTSTAT "CVS/Entries.Static"
122 #define CVSADM_REP "CVS/Repository."
123 #define CVSADM_ROOT "CVS/Root."
124 #define CVSADM_CIPROG "CVS/Checkin.prog"
125 #define CVSADM_UPROG "CVS/Update.prog"
126 #define CVSADM_TAG "CVS/Tag."
127 #define CVSADM_NOTIFY "CVS/Notify."
128 #define CVSADM_NOTIFYTMP "CVS/Notify.tmp"
129 #define CVSADM_BASE "CVS/Base"
130 #define CVSADM_BASEREV "CVS/Baserev."
131 #define CVSADM_BASEREVTMP "CVS/Baserev.tmp"
132 #define CVSADM_TEMPLATE "CVS/Template."
133 #else /* USE_VMS_FILENAMES */
135 #define CVSADM_ENT "CVS/Entries"
136 #define CVSADM_ENTBAK "CVS/Entries.Backup"
137 #define CVSADM_ENTLOG "CVS/Entries.Log"
138 #define CVSADM_ENTSTAT "CVS/Entries.Static"
139 #define CVSADM_REP "CVS/Repository"
140 #define CVSADM_ROOT "CVS/Root"
141 #define CVSADM_CIPROG "CVS/Checkin.prog"
142 #define CVSADM_UPROG "CVS/Update.prog"
143 #define CVSADM_TAG "CVS/Tag"
144 #define CVSADM_NOTIFY "CVS/Notify"
145 #define CVSADM_NOTIFYTMP "CVS/Notify.tmp"
146 /* A directory in which we store base versions of files we currently are
147 editing with "cvs edit". */
148 #define CVSADM_BASE "CVS/Base"
149 #define CVSADM_BASEREV "CVS/Baserev"
150 #define CVSADM_BASEREVTMP "CVS/Baserev.tmp"
151 /* File which contains the template for use in log messages. */
152 #define CVSADM_TEMPLATE "CVS/Template"
153 #endif /* USE_VMS_FILENAMES */
155 /* This is the special directory which we use to store various extra
156 per-directory information in the repository. It must be the same as
157 CVSADM to avoid creating a new reserved directory name which users cannot
158 use, but is a separate #define because if anyone changes it (which I don't
159 recommend), one needs to deal with old, unconverted, repositories.
161 See fileattr.h for details about file attributes, the only thing stored
162 in CVSREP currently. */
166 * Definitions for the CVSROOT Administrative directory and the files it
167 * contains. This directory is created as a sub-directory of the $CVSROOT
168 * environment variable, and holds global administration information for the
169 * entire source repository beginning at $CVSROOT.
171 #define CVSROOTADM "CVSROOT"
172 #define CVSROOTADM_MODULES "modules"
173 #define CVSROOTADM_LOGINFO "loginfo"
174 #define CVSROOTADM_RCSINFO "rcsinfo"
175 #define CVSROOTADM_COMMITINFO "commitinfo"
176 #define CVSROOTADM_TAGINFO "taginfo"
177 #define CVSROOTADM_EDITINFO "editinfo"
178 #define CVSROOTADM_VERIFYMSG "verifymsg"
179 #define CVSROOTADM_HISTORY "history"
180 #define CVSROOTADM_VALTAGS "val-tags"
181 #define CVSROOTADM_IGNORE "cvsignore"
182 #define CVSROOTADM_CHECKOUTLIST "checkoutlist"
183 #define CVSROOTADM_WRAPPER "cvswrappers"
184 #define CVSROOTADM_NOTIFY "notify"
185 #define CVSROOTADM_USERS "users"
186 #define CVSROOTADM_READERS "readers"
187 #define CVSROOTADM_WRITERS "writers"
188 #define CVSROOTADM_PASSWD "passwd"
189 #define CVSROOTADM_CONFIG "config"
190 #define CVSROOTADM_OPTIONS "options"
192 #define CVSNULLREPOS "Emptydir" /* an empty directory */
194 /* Other CVS file names */
196 /* Files go in the attic if the head main branch revision is dead,
197 otherwise they go in the regular repository directories. The whole
198 concept of having an attic is sort of a relic from before death
199 support but on the other hand, it probably does help the speed of
200 some operations (such as main branch checkouts and updates). */
201 #define CVSATTIC "Attic"
203 #define CVSLCK "#cvs.lock"
204 #define CVSRFL "#cvs.rfl"
205 #define CVSWFL "#cvs.wfl"
206 #define CVSRFLPAT "#cvs.rfl.*" /* wildcard expr to match read locks */
207 #define CVSEXT_LOG ",t"
208 #define CVSPREFIX ",,"
209 #define CVSDOTIGNORE ".cvsignore"
210 #define CVSDOTWRAPPER ".cvswrappers"
212 /* Command attributes -- see function lookup_command_attribute(). */
213 #define CVS_CMD_IGNORE_ADMROOT 1
215 /* Set if CVS needs to create a CVS/Root file upon completion of this
216 command. The name may be slightly confusing, because the flag
217 isn't really as general purpose as it seems (it is not set for cvs
220 #define CVS_CMD_USES_WORK_DIR 2
222 #define CVS_CMD_MODIFIES_REPOSITORY 4
224 /* miscellaneous CVS defines */
226 /* This is the string which is at the start of the non-log-message lines
227 that we put up for the user when they edit the log message. */
228 #define CVSEDITPREFIX "CVS: "
229 /* Number of characters in CVSEDITPREFIX to compare when deciding to strip
230 off those lines. We don't check for the space, to accomodate users who
231 have editors which strip trailing spaces. */
232 #define CVSEDITPREFIXLEN 4
234 #define CVSLCKAGE (60*60) /* 1-hour old lock files cleaned up */
235 #define CVSLCKSLEEP 30 /* wait 30 seconds before retrying */
236 #define CVSBRANCH "1.1.1" /* RCS branch used for vendor srcs */
238 #ifdef USE_VMS_FILENAMES
239 #define BAKPREFIX "_$"
240 #define DEVNULL "NLA0:"
241 #else /* USE_VMS_FILENAMES */
242 #define BAKPREFIX ".#" /* when rcsmerge'ing */
244 #define DEVNULL "/dev/null"
246 #endif /* USE_VMS_FILENAMES */
249 * Special tags. -rHEAD refers to the head of an RCS file, regardless of any
250 * sticky tags. -rBASE refers to the current revision the user has checked
251 * out This mimics the behaviour of RCS.
253 #define TAG_HEAD "HEAD"
254 #define TAG_BASE "BASE"
256 /* Environment variable used by CVS */
257 #define CVSREAD_ENV "CVSREAD" /* make files read-only */
258 #define CVSREAD_DFLT 0 /* writable files by default */
260 #define CVSREADONLYFS_ENV "CVSREADONLYFS" /* repository is read-only */
262 #define TMPDIR_ENV "TMPDIR" /* Temporary directory */
263 /* #define TMPDIR_DFLT Set by options.h */
265 #define EDITOR1_ENV "CVSEDITOR" /* which editor to use */
266 #define EDITOR2_ENV "VISUAL" /* which editor to use */
267 #define EDITOR3_ENV "EDITOR" /* which editor to use */
268 /* #define EDITOR_DFLT Set by options.h */
270 #define CVSROOT_ENV "CVSROOT" /* source directory root */
271 #define CVSROOT_DFLT NULL /* No dflt; must set for checkout */
273 #define IGNORE_ENV "CVSIGNORE" /* More files to ignore */
274 #define WRAPPER_ENV "CVSWRAPPERS" /* name of the wrapper file */
276 #define CVSUMASK_ENV "CVSUMASK" /* Effective umask for repository */
277 /* #define CVSUMASK_DFLT Set by options.h */
280 * If the beginning of the Repository matches the following string, strip it
281 * so that the output to the logfile does not contain a full pathname.
283 * If the CVSROOT environment variable is set, it overrides this define.
285 #define REPOS_STRIP "/master/"
287 /* Large enough to hold DATEFORM. Not an arbitrary limit as long as
288 it is used for that purpose, and not to hold a string from the
289 command line, the client, etc. */
290 #define MAXDATELEN 50
292 /* The type of an entnode. */
298 /* structure of a entry record */
305 /* Timestamp, or "" if none (never NULL). */
308 /* Keyword expansion options, or "" if none (never NULL). */
315 typedef struct entnode Entnode;
317 /* The type of request that is being done in do_module() */
320 CHECKOUT, TAG, PATCH, EXPORT
324 * structure used for list-private storage by Entries_Open() and
325 * Version_TS() and Find_Directories().
329 /* These fields pass sticky tag information from Entries_Open() to
336 /* This field is set by Entries_Open() if there was subdirectory
337 information; Find_Directories() uses it to see whether it needs
338 to scan the directory itself. */
342 /* Flags for find_{names,dirs} routines */
343 #define W_LOCAL 0x01 /* look for files locally */
344 #define W_REPOS 0x02 /* look for files in the repository */
345 #define W_ATTIC 0x04 /* look for files in the attic */
347 /* Flags for return values of direnter procs for the recursion processor */
350 R_PROCESS = 1, /* process files and maybe dirs */
351 R_SKIP_FILES, /* don't process files in this dir */
352 R_SKIP_DIRS, /* don't process sub-dirs */
353 R_SKIP_ALL /* don't process files or dirs */
355 #ifdef ENUMS_CAN_BE_TROUBLE
358 typedef enum direnter_type Dtype;
361 extern char *program_name, *program_path, *command_name;
362 extern char *Tmpdir, *Editor;
363 extern int cvsadmin_root;
365 extern int really_quiet, quiet;
366 extern int use_editor;
368 extern mode_t cvsumask;
369 extern char *RCS_citag;
371 /* Access method specified in CVSroot. */
373 local_method, server_method, pserver_method, kserver_method, gserver_method,
376 extern char *method_names[]; /* change this in root.c if you change
379 extern char *CVSroot_original; /* the active, complete CVSroot string */
380 extern int client_active; /* nonzero if we are doing remote access */
381 extern CVSmethod CVSroot_method; /* one of the enum values above */
382 extern char *CVSroot_username; /* the username or NULL if method == local */
383 extern char *CVSroot_hostname; /* the hostname or NULL if method == local */
384 extern char *CVSroot_directory; /* the directory name */
386 extern char *emptydir_name PROTO ((void));
388 extern int trace; /* Show all commands */
389 extern int noexec; /* Don't modify disk anywhere */
390 extern int readonlyfs; /* fail on all write locks; succeed all read locks */
391 extern int logoff; /* Don't write history entry */
392 extern int require_real_user; /* skip CVSROOT/passwd, /etc/passwd users only*/
394 extern int top_level_admin;
396 #ifdef AUTH_SERVER_SUPPORT
397 extern char *Pserver_Repos; /* used to check that same repos is
398 transmitted in pserver auth and in
400 #endif /* AUTH_SERVER_SUPPORT */
402 extern char hostname[];
404 /* Externs that are included directly in the CVS sources */
406 int RCS_merge PROTO((RCSNode *, char *, char *, char *, char *, char *));
407 /* Flags used by RCS_* functions. See the description of the individual
408 functions for which flags mean what for each function. */
409 #define RCS_FLAGS_FORCE 1
410 #define RCS_FLAGS_DEAD 2
411 #define RCS_FLAGS_QUIET 4
412 #define RCS_FLAGS_MODTIME 8
413 #define RCS_FLAGS_KEEPFILE 16
415 extern int RCS_exec_rcsdiff PROTO ((RCSNode *rcsfile,
416 char *opts, char *options,
417 char *rev1, char *rev2,
418 char *label1, char *label2,
420 extern int diff_exec PROTO ((char *file1, char *file2, char *options,
422 extern int diff_execv PROTO ((char *file1, char *file2,
423 char *label1, char *label2,
424 char *options, char *out));
430 DBM *open_module PROTO((void));
431 FILE *open_file PROTO((const char *, const char *));
432 List *Find_Directories PROTO((char *repository, int which, List *entries));
433 void Entries_Close PROTO((List *entries));
434 List *Entries_Open PROTO ((int aflag, char *update_dir));
435 void Subdirs_Known PROTO((List *entries));
436 void Subdir_Register PROTO((List *, const char *, const char *));
437 void Subdir_Deregister PROTO((List *, const char *, const char *));
439 char *Make_Date PROTO((char *rawdate));
440 char *date_from_time_t PROTO ((time_t));
442 char *Name_Repository PROTO((char *dir, char *update_dir));
443 char *Short_Repository PROTO((char *repository));
444 void Sanitize_Repository_Name PROTO((char *repository));
446 char *Name_Root PROTO((char *dir, char *update_dir));
447 int parse_cvsroot PROTO((char *CVSroot));
448 void set_local_cvsroot PROTO((char *dir));
449 void Create_Root PROTO((char *dir, char *rootdir));
450 void root_allow_add PROTO ((char *));
451 void root_allow_free PROTO ((void));
452 int root_allow_ok PROTO ((char *));
454 char *gca PROTO((const char *rev1, const char *rev2));
455 extern void check_numeric PROTO ((const char *, int, char **));
456 char *getcaller PROTO((void));
457 char *time_stamp PROTO((char *file));
459 char *xmalloc PROTO((size_t bytes));
460 void *xrealloc PROTO((void *ptr, size_t bytes));
461 void expand_string PROTO ((char **, size_t *, size_t));
462 char *xstrdup PROTO((const char *str));
463 void strip_trailing_newlines PROTO((char *str));
464 int pathname_levels PROTO ((char *path));
466 typedef int (*CALLPROC) PROTO((char *repository, char *value));
467 int Parse_Info PROTO((char *infofile, char *repository, CALLPROC callproc, int all));
468 extern int parse_config PROTO ((char *));
470 typedef RETSIGTYPE (*SIGCLEANUPPROC) PROTO(());
471 int SIG_register PROTO((int sig, SIGCLEANUPPROC sigcleanup));
472 int isdir PROTO((const char *file));
473 int isfile PROTO((const char *file));
474 int islink PROTO((const char *file));
475 int isdevice PROTO ((const char *));
476 int isreadable PROTO((const char *file));
477 int iswritable PROTO((const char *file));
478 int isaccessible PROTO((const char *file, const int mode));
479 int isabsolute PROTO((const char *filename));
480 char *xreadlink PROTO((const char *link));
481 char *last_component PROTO((char *path));
482 char *get_homedir PROTO ((void));
483 char *cvs_temp_name PROTO ((void));
484 void parseopts PROTO ((const char *root));
486 int numdots PROTO((const char *s));
487 char *increment_revnum PROTO ((const char *));
488 int compare_revnums PROTO ((const char *, const char *));
489 int unlink_file PROTO((const char *f));
490 int unlink_file_dir PROTO((const char *f));
491 int update PROTO((int argc, char *argv[]));
492 int xcmp PROTO((const char *file1, const char *file2));
493 int yesno PROTO((void));
494 void *valloc PROTO((size_t bytes));
495 time_t get_date PROTO((char *date, struct timeb *now));
496 extern int Create_Admin PROTO ((char *dir, char *update_dir,
497 char *repository, char *tag, char *date,
498 int nonbranch, int warn));
499 extern int expand_at_signs PROTO ((char *, off_t, FILE *));
501 /* Locking subsystem (implemented in lock.c). */
503 int Reader_Lock PROTO((char *xrepository));
504 void Lock_Cleanup PROTO((void));
506 /* Writelock an entire subtree, well the part specified by ARGC, ARGV, LOCAL,
507 and AFLAG, anyway. */
508 void lock_tree_for_write PROTO ((int argc, char **argv, int local, int aflag));
510 /* See lock.c for description. */
511 extern void lock_dir_for_write PROTO ((char *));
513 void Scratch_Entry PROTO((List * list, char *fname));
514 void ParseTag PROTO((char **tagp, char **datep, int *nonbranchp));
515 void WriteTag PROTO ((char *dir, char *tag, char *date, int nonbranch,
516 char *update_dir, char *repository));
517 void cat_module PROTO((int status));
518 void check_entries PROTO((char *dir));
519 void close_module PROTO((DBM * db));
520 void copy_file PROTO((const char *from, const char *to));
521 void fperror PROTO((FILE * fp, int status, int errnum, char *message,...));
522 void free_names PROTO((int *pargc, char *argv[]));
524 extern int ign_name PROTO ((char *name));
525 void ign_add PROTO((char *ign, int hold));
526 void ign_add_file PROTO((char *file, int hold));
527 void ign_setup PROTO((void));
528 void ign_dir_add PROTO((char *name));
529 int ignore_directory PROTO((char *name));
530 typedef void (*Ignore_proc) PROTO ((char *, char *));
531 extern void ignore_files PROTO ((List *, List *, char *, Ignore_proc));
532 extern int ign_inhibit_server;
537 void line2argv PROTO ((int *pargc, char ***argv, char *line, char *sepchars));
538 void make_directories PROTO((const char *name));
539 void make_directory PROTO((const char *name));
540 extern int mkdir_if_needed PROTO ((char *name));
541 void rename_file PROTO((const char *from, const char *to));
542 /* Expand wildcards in each element of (ARGC,ARGV). This is according to the
543 files which exist in the current directory, and accordingly to OS-specific
544 conventions regarding wildcard syntax. It might be desirable to change the
545 former in the future (e.g. "cvs status *.h" including files which don't exist
546 in the working directory). The result is placed in *PARGC and *PARGV;
547 the *PARGV array itself and all the strings it contains are newly
548 malloc'd. It is OK to call it with PARGC == &ARGC or PARGV == &ARGV. */
549 extern void expand_wild PROTO ((int argc, char **argv,
550 int *pargc, char ***pargv));
552 #ifdef SERVER_SUPPORT
553 extern int cvs_casecmp PROTO ((char *, char *));
554 extern int fopen_case PROTO ((char *, char *, FILE **, char **));
557 void strip_trailing_slashes PROTO((char *path));
558 void update_delproc PROTO((Node * p));
559 void usage PROTO((const char *const *cpp));
560 void xchmod PROTO((char *fname, int writable));
561 char *xgetwd PROTO((void));
562 List *Find_Names PROTO((char *repository, int which, int aflag,
563 List ** optentries));
564 void Register PROTO((List * list, char *fname, char *vn, char *ts,
565 char *options, char *tag, char *date, char *ts_conflict));
566 void Update_Logfile PROTO((char *repository, char *xmessage, FILE * xlogfp,
568 void do_editor PROTO((char *dir, char **messagep,
569 char *repository, List * changes));
571 void do_verify PROTO((char **messagep, char *repository));
573 typedef int (*CALLBACKPROC) PROTO((int *pargc, char *argv[], char *where,
574 char *mwhere, char *mfile, int shorten, int local_specified,
575 char *omodule, char *msg));
577 /* This is the structure that the recursion processor passes to the
578 fileproc to tell it about a particular file. */
581 /* Name of the file, without any directory component. */
584 /* Name of the directory we are in, relative to the directory in
585 which this command was issued. We have cd'd to this directory
586 (either in the working directory or in the repository, depending
587 on which sort of recursion we are doing). If we are in the directory
588 in which the command was issued, this is "". */
591 /* update_dir and file put together, with a slash between them as
592 necessary. This is the proper way to refer to the file in user
596 /* Name of the directory corresponding to the repository which contains
600 /* The pre-parsed entries for this directory. */
606 typedef int (*FILEPROC) PROTO ((void *callerdat, struct file_info *finfo));
607 typedef int (*FILESDONEPROC) PROTO ((void *callerdat, int err,
608 char *repository, char *update_dir,
610 typedef Dtype (*DIRENTPROC) PROTO ((void *callerdat, char *dir,
611 char *repos, char *update_dir,
613 typedef int (*DIRLEAVEPROC) PROTO ((void *callerdat, char *dir, int err,
614 char *update_dir, List *entries));
616 extern int mkmodules PROTO ((char *dir));
617 extern int init PROTO ((int argc, char **argv));
619 int do_module PROTO((DBM * db, char *mname, enum mtype m_type, char *msg,
620 CALLBACKPROC callback_proc, char *where, int shorten,
621 int local_specified, int run_module_prog, char *extra_arg));
622 void history_write PROTO((int type, char *update_dir, char *revs, char *name,
624 int start_recursion PROTO((FILEPROC fileproc, FILESDONEPROC filesdoneproc,
625 DIRENTPROC direntproc, DIRLEAVEPROC dirleaveproc,
627 int argc, char *argv[], int local, int which,
628 int aflag, int readlock, char *update_preload,
630 void SIG_beginCrSect PROTO((void));
631 void SIG_endCrSect PROTO((void));
632 void read_cvsrc PROTO((int *argc, char ***argv, char *cmdname));
634 char *make_message_rcslegal PROTO((char *message));
635 extern int file_has_markers PROTO ((const struct file_info *));
636 extern void get_file PROTO ((const char *, const char *, const char *,
637 char **, size_t *, size_t *));
639 /* flags for run_exec(), the fast system() for CVS */
640 #define RUN_NORMAL 0x0000 /* no special behaviour */
641 #define RUN_COMBINED 0x0001 /* stdout is duped to stderr */
642 #define RUN_REALLY 0x0002 /* do the exec, even if noexec is on */
643 #define RUN_STDOUT_APPEND 0x0004 /* append to stdout, don't truncate */
644 #define RUN_STDERR_APPEND 0x0008 /* append to stderr, don't truncate */
645 #define RUN_SIGIGNORE 0x0010 /* ignore interrupts for command */
646 #define RUN_TTY (char *)0 /* for the benefit of lint */
648 void run_arg PROTO((const char *s));
649 void run_print PROTO((FILE * fp));
650 void run_setup PROTO ((const char *prog));
651 int run_exec PROTO((const char *stin, const char *stout, const char *sterr,
654 /* other similar-minded stuff from run.c. */
655 FILE *run_popen PROTO((const char *, const char *));
656 int piped_child PROTO((char **, int *, int *));
657 void close_on_exec PROTO((int));
658 int filter_stream_through_program PROTO((int, int, char **, pid_t *));
660 pid_t waitpid PROTO((pid_t, int *, int));
663 * a struct vers_ts contains all the information about a file including the
664 * user and rcs file names, and the version checked out and the head.
666 * this is usually obtained from a call to Version_TS which takes a
667 * tag argument for the RCS file if desired
671 /* rcs version user file derives from, from CVS/Entries.
672 It can have the following special values:
674 NULL = file is not mentioned in Entries (this is also used for a
676 "" = ILLEGAL! The comment used to say that it meant "no user file"
677 but as far as I know CVS didn't actually use it that way.
678 Note that according to cvs.texinfo, "" is not legal in the
681 -vers = user file to be removed. */
684 /* Numeric revision number corresponding to ->vn_tag (->vn_tag
685 will often be symbolic). */
687 /* If ->tag is a simple tag in the RCS file--a tag which really
688 exists which is not a magic revision--and if ->date is NULL,
689 then this is a copy of ->tag. Otherwise, it is a copy of
693 /* This is the timestamp from stating the file in the working directory.
694 It is NULL if there is no file in the working directory. It is
695 "Is-modified" if we know the file is modified but don't have its
698 /* Timestamp from CVS/Entries. For the server, ts_user and ts_rcs
699 are computed in a slightly different way, but the fact remains that
700 if they are equal the file in the working directory is unmodified
701 and if they differ it is modified. */
704 /* Options from CVS/Entries (keyword expansion), malloc'd. If none,
705 then it is an empty string (never NULL). */
708 /* If non-NULL, there was a conflict (or merely a merge? See merge_file)
709 and the time stamp in this field is the time stamp of the working
710 directory file which was created with the conflict markers in it.
711 This is from CVS/Entries. */
714 /* Tag specified on the command line, or if none, tag stored in
717 /* Date specified on the command line, or if none, date stored in
720 /* If this is 1, then tag is not a branch tag. If this is 0, then
721 tag may or may not be a branch tag. */
724 /* Pointer to entries file node */
727 /* Pointer to parsed src file info */
730 typedef struct vers_ts Vers_TS;
732 Vers_TS *Version_TS PROTO ((struct file_info *finfo, char *options, char *tag,
733 char *date, int force_tag_match,
735 void freevers_ts PROTO ((Vers_TS ** versp));
737 /* Miscellaneous CVS infrastructure which layers on top of the recursion
738 processor (for example, needs struct file_info). */
740 int Checkin PROTO ((int type, struct file_info *finfo, char *rcs, char *rev,
741 char *tag, char *options, char *message));
742 int No_Difference PROTO ((struct file_info *finfo, Vers_TS *vers));
743 /* TODO: can the finfo argument to special_file_mismatch be changed? -twp */
744 int special_file_mismatch PROTO ((struct file_info *finfo,
745 char *rev1, char *rev2));
747 /* CVSADM_BASEREV stuff, from entries.c. */
748 extern char *base_get PROTO ((struct file_info *));
749 extern void base_register PROTO ((struct file_info *, char *));
750 extern void base_deregister PROTO ((struct file_info *));
753 * defines for Classify_File() to determine the current state of a file.
754 * These are also used as types in the data field for the list we make for
755 * Update_Logfile in commit, import, and add.
759 T_UNKNOWN = 1, /* no old-style analog existed */
760 T_CONFLICT, /* C (conflict) list */
761 T_NEEDS_MERGE, /* G (needs merging) list */
762 T_MODIFIED, /* M (needs checked in) list */
763 T_CHECKOUT, /* O (needs checkout) list */
764 T_ADDED, /* A (added file) list */
765 T_REMOVED, /* R (removed file) list */
766 T_REMOVE_ENTRY, /* W (removed entry) list */
767 T_UPTODATE, /* File is up-to-date */
768 #ifdef SERVER_SUPPORT
769 T_PATCH, /* P Like C, but can patch */
771 T_TITLE /* title for node type */
773 typedef enum classify_type Ctype;
775 Ctype Classify_File PROTO
776 ((struct file_info *finfo, char *tag, char *date, char *options,
777 int force_tag_match, int aflag, Vers_TS **versp, int pipeout));
780 * structure used for list nodes passed to Update_Logfile() and
785 enum classify_type type;
787 char *rev_old; /* rev number before a commit/modify,
788 NULL for add or import */
789 char *rev_new; /* rev number after a commit/modify,
790 add, or import, NULL for remove */
795 typedef enum { WRAP_MERGE, WRAP_COPY } WrapMergeMethod;
797 /* -t and -f wrapper options. Treating directories as single files. */
800 /* -k wrapper option. Default keyword expansion options. */
804 void wrap_setup PROTO((void));
805 int wrap_name_has PROTO((const char *name,WrapMergeHas has));
806 char *wrap_rcsoption PROTO ((const char *fileName, int asFlag));
807 char *wrap_tocvs_process_file PROTO((const char *fileName));
808 int wrap_merge_is_copy PROTO((const char *fileName));
809 void wrap_fromcvs_process_file PROTO ((const char *fileName));
810 void wrap_add_file PROTO((const char *file,int temp));
811 void wrap_add PROTO((char *line,int temp));
812 void wrap_send PROTO ((void));
813 #if defined(SERVER_SUPPORT) || defined(CLIENT_SUPPORT)
814 void wrap_unparse_rcs_options PROTO ((char **, int));
815 #endif /* SERVER_SUPPORT || CLIENT_SUPPORT */
817 /* Pathname expansion */
818 char *expand_path PROTO((char *name, char *file, int line));
820 /* User variables. */
821 extern List *variable_list;
823 extern void variable_set PROTO ((char *nameval));
825 int watch PROTO ((int argc, char **argv));
826 int edit PROTO ((int argc, char **argv));
827 int unedit PROTO ((int argc, char **argv));
828 int editors PROTO ((int argc, char **argv));
829 int watchers PROTO ((int argc, char **argv));
830 extern int annotate PROTO ((int argc, char **argv));
831 extern int add PROTO ((int argc, char **argv));
832 extern int admin PROTO ((int argc, char **argv));
833 extern int checkout PROTO ((int argc, char **argv));
834 extern int commit PROTO ((int argc, char **argv));
835 extern int diff PROTO ((int argc, char **argv));
836 extern int history PROTO ((int argc, char **argv));
837 extern int import PROTO ((int argc, char **argv));
838 extern int cvslog PROTO ((int argc, char **argv));
839 #ifdef AUTH_CLIENT_SUPPORT
840 extern int login PROTO((int argc, char **argv));
841 int logout PROTO((int argc, char **argv));
842 #endif /* AUTH_CLIENT_SUPPORT */
843 extern int patch PROTO((int argc, char **argv));
844 extern int release PROTO((int argc, char **argv));
845 extern int cvsremove PROTO((int argc, char **argv));
846 extern int rtag PROTO((int argc, char **argv));
847 extern int cvsstatus PROTO((int argc, char **argv));
848 extern int cvstag PROTO((int argc, char **argv));
850 extern unsigned long int lookup_command_attribute PROTO((char *));
852 #if defined(AUTH_CLIENT_SUPPORT) || defined(AUTH_SERVER_SUPPORT)
853 char *scramble PROTO ((char *str));
854 char *descramble PROTO ((char *str));
855 #endif /* AUTH_CLIENT_SUPPORT || AUTH_SERVER_SUPPORT */
857 #ifdef AUTH_CLIENT_SUPPORT
858 char *get_cvs_password PROTO((void));
859 #endif /* AUTH_CLIENT_SUPPORT */
861 extern void tag_check_valid PROTO ((char *, int, char **, int, int, char *));
862 extern void tag_check_valid_join PROTO ((char *, int, char **, int, int,
865 /* From server.c and documented there. */
866 extern void cvs_output PROTO ((const char *, size_t));
867 extern void cvs_output_binary PROTO ((char *, size_t));
868 extern void cvs_outerr PROTO ((const char *, size_t));
869 extern void cvs_flusherr PROTO ((void));
870 extern void cvs_flushout PROTO ((void));
871 extern void cvs_output_tagged PROTO ((char *, char *));
873 #if defined(SERVER_SUPPORT) || defined(CLIENT_SUPPORT)