]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/cvs/src/cvs.h
Import of slightly trimmed cvs-1.8 distribution. Generated files
[FreeBSD/FreeBSD.git] / contrib / cvs / src / cvs.h
1 /* $CVSid: @(#)cvs.h 1.86 94/10/22 $     */
2
3 /*
4  * basic information used in all source files
5  *
6  */
7
8
9 #include "config.h"             /* this is stuff found via autoconf */
10 #include "options.h"            /* these are some larger questions which
11                                    can't easily be automatically checked
12                                    for */
13
14 /* Changed from if __STDC__ to ifdef __STDC__ because of Sun's acc compiler */
15
16 #ifdef __STDC__
17 #define PTR     void *
18 #else
19 #define PTR     char *
20 #endif
21
22 /* Add prototype support.  */
23 #ifndef PROTO
24 #if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
25 #define PROTO(ARGS) ARGS
26 #else
27 #define PROTO(ARGS) ()
28 #endif
29 #endif
30
31 #include <stdio.h>
32
33 /* Under OS/2, <stdio.h> doesn't define popen()/pclose(). */
34 #ifdef USE_OWN_POPEN
35 #include "popen.h"
36 #endif
37
38 #ifdef STDC_HEADERS
39 #include <stdlib.h>
40 #else
41 extern void exit ();
42 extern char *getenv();
43 #endif
44
45 #ifdef HAVE_UNISTD_H
46 #include <unistd.h>
47 #endif
48
49 #ifdef HAVE_STRING_H
50 #include <string.h>
51 #else
52 #include <strings.h>
53 #endif
54
55 #ifdef SERVER_SUPPORT
56 /* If the system doesn't provide strerror, it won't be declared in
57    string.h.  */
58 char *strerror ();
59 #endif
60
61 #include <fnmatch.h> /* This is supposed to be available on Posix systems */
62
63 #include <ctype.h>
64 #include <pwd.h>
65 #include <signal.h>
66
67 #ifdef HAVE_ERRNO_H
68 #include <errno.h>
69 #else
70 #ifndef errno
71 extern int errno;
72 #endif /* !errno */
73 #endif /* HAVE_ERRNO_H */
74
75 #include "system.h"
76
77 #include "hash.h"
78 #if defined(SERVER_SUPPORT) || defined(CLIENT_SUPPORT)
79 #include "server.h"
80 #include "client.h"
81 #endif
82
83 #ifdef MY_NDBM
84 #include "myndbm.h"
85 #else
86 #include <ndbm.h>
87 #endif /* MY_NDBM */
88
89 #include "regex.h"
90 #include "getopt.h"
91 #include "wait.h"
92
93 #include "rcs.h"
94
95
96 /* XXX - for now this is static */
97 #ifndef PATH_MAX
98 #ifdef MAXPATHLEN
99 #define PATH_MAX MAXPATHLEN+2
100 #else
101 #define PATH_MAX 1024+2
102 #endif
103 #endif /* PATH_MAX */
104
105 /* just in case this implementation does not define this */
106 #ifndef L_tmpnam
107 #define L_tmpnam        50
108 #endif
109
110
111 /*
112  * Copyright (c) 1992, Brian Berliner and Jeff Polk
113  * Copyright (c) 1989-1992, Brian Berliner
114  *
115  * You may distribute under the terms of the GNU General Public License as
116  * specified in the README file that comes with the CVS 1.4 kit.
117  *
118  * Definitions for the CVS Administrative directory and the files it contains.
119  * Here as #define's to make changing the names a simple task.
120  */
121
122 #ifdef USE_VMS_FILENAMES
123 #define CVSADM          "CVS"
124 #define CVSADM_ENT      "CVS/Entries."
125 #define CVSADM_ENTBAK   "CVS/Entries.Backup"
126 #define CVSADM_ENTLOG   "CVS/Entries.Log"
127 #define CVSADM_ENTSTAT  "CVS/Entries.Static"
128 #define CVSADM_REP      "CVS/Repository."
129 #define CVSADM_ROOT     "CVS/Root."
130 #define CVSADM_CIPROG   "CVS/Checkin.prog"
131 #define CVSADM_UPROG    "CVS/Update.prog"
132 #define CVSADM_TAG      "CVS/Tag."
133 #define CVSADM_NOTIFY   "CVS/Notify."
134 #define CVSADM_NOTIFYTMP "CVS/Notify.tmp"
135 #define CVSADM_BASE      "CVS/Base"
136 #define CVSADM_TEMPLATE "CVS/Template."
137 #else /* USE_VMS_FILENAMES */
138 #define CVSADM          "CVS"
139 #define CVSADM_ENT      "CVS/Entries"
140 #define CVSADM_ENTBAK   "CVS/Entries.Backup"
141 #define CVSADM_ENTLOG   "CVS/Entries.Log"
142 #define CVSADM_ENTSTAT  "CVS/Entries.Static"
143 #define CVSADM_REP      "CVS/Repository"
144 #define CVSADM_ROOT     "CVS/Root"
145 #define CVSADM_CIPROG   "CVS/Checkin.prog"
146 #define CVSADM_UPROG    "CVS/Update.prog"
147 #define CVSADM_TAG      "CVS/Tag"
148 #define CVSADM_NOTIFY   "CVS/Notify"
149 #define CVSADM_NOTIFYTMP "CVS/Notify.tmp"
150 /* A directory in which we store base versions of files we currently are
151    editing with "cvs edit".  */
152 #define CVSADM_BASE     "CVS/Base"
153 /* File which contains the template for use in log messages.  */
154 #define CVSADM_TEMPLATE "CVS/Template"
155 #endif /* USE_VMS_FILENAMES */
156
157 /* This is the special directory which we use to store various extra
158    per-directory information in the repository.  It must be the same as
159    CVSADM to avoid creating a new reserved directory name which users cannot
160    use, but is a separate #define because if anyone changes it (which I don't
161    recommend), one needs to deal with old, unconverted, repositories.
162    
163    See fileattr.h for details about file attributes, the only thing stored
164    in CVSREP currently.  */
165 #define CVSREP "CVS"
166
167 /*
168  * Definitions for the CVSROOT Administrative directory and the files it
169  * contains.  This directory is created as a sub-directory of the $CVSROOT
170  * environment variable, and holds global administration information for the
171  * entire source repository beginning at $CVSROOT.
172  */
173 #define CVSROOTADM              "CVSROOT"
174 #define CVSROOTADM_MODULES      "modules"
175 #define CVSROOTADM_LOGINFO      "loginfo"
176 #define CVSROOTADM_RCSINFO      "rcsinfo"
177 #define CVSROOTADM_COMMITINFO   "commitinfo"
178 #define CVSROOTADM_TAGINFO      "taginfo"
179 #define CVSROOTADM_EDITINFO     "editinfo"
180 #define CVSROOTADM_HISTORY      "history"
181 #define CVSROOTADM_VALTAGS      "val-tags"
182 #define CVSROOTADM_IGNORE       "cvsignore"
183 #define CVSROOTADM_CHECKOUTLIST "checkoutlist"
184 #define CVSROOTADM_WRAPPER      "cvswrappers"
185 #define CVSROOTADM_NOTIFY       "notify"
186 #define CVSROOTADM_USERS        "users"
187
188 #define CVSNULLREPOS            "Emptydir"      /* an empty directory */
189
190 /* Other CVS file names */
191
192 /* Files go in the attic if the head main branch revision is dead,
193    otherwise they go in the regular repository directories.  The whole
194    concept of having an attic is sort of a relic from before death
195    support but on the other hand, it probably does help the speed of
196    some operations (such as main branch checkouts and updates).  */
197 #define CVSATTIC        "Attic"
198
199 #define CVSLCK          "#cvs.lock"
200 #define CVSRFL          "#cvs.rfl"
201 #define CVSWFL          "#cvs.wfl"
202 #define CVSRFLPAT       "#cvs.rfl.*"    /* wildcard expr to match read locks */
203 #define CVSEXT_LOG      ",t"
204 #define CVSPREFIX       ",,"
205 #define CVSDOTIGNORE    ".cvsignore"
206 #define CVSDOTWRAPPER   ".cvswrappers"
207
208 /* miscellaneous CVS defines */
209 #define CVSEDITPREFIX   "CVS: "
210 #define CVSLCKAGE       (60*60)         /* 1-hour old lock files cleaned up */
211 #define CVSLCKSLEEP     30              /* wait 30 seconds before retrying */
212 #define CVSBRANCH       "1.1.1"         /* RCS branch used for vendor srcs */
213
214 #ifdef USE_VMS_FILENAMES
215 #define BAKPREFIX       "_$"
216 #define DEVNULL         "NLA0:"
217 #else /* USE_VMS_FILENAMES */
218 #define BAKPREFIX       ".#"            /* when rcsmerge'ing */
219 #ifndef DEVNULL
220 #define DEVNULL         "/dev/null"
221 #endif
222 #endif /* USE_VMS_FILENAMES */
223
224 #define FALSE           0
225 #define TRUE            1
226
227 /*
228  * Special tags. -rHEAD refers to the head of an RCS file, regardless of any
229  * sticky tags. -rBASE  refers to the current revision the user has checked
230  * out This mimics the behaviour of RCS.
231  */
232 #define TAG_HEAD        "HEAD"
233 #define TAG_BASE        "BASE"
234
235 /* Environment variable used by CVS */
236 #define CVSREAD_ENV     "CVSREAD"       /* make files read-only */
237 #define CVSREAD_DFLT    FALSE           /* writable files by default */
238
239 #define RCSBIN_ENV      "RCSBIN"        /* RCS binary directory */
240 /* #define      RCSBIN_DFLT                Set by config.h */
241
242 #define EDITOR1_ENV     "CVSEDITOR"     /* which editor to use */
243 #define EDITOR2_ENV     "VISUAL"        /* which editor to use */
244 #define EDITOR3_ENV     "EDITOR"        /* which editor to use */
245 /* #define      EDITOR_DFLT                Set by config.h */
246
247 #define CVSROOT_ENV     "CVSROOT"       /* source directory root */
248 #define CVSROOT_DFLT    NULL            /* No dflt; must set for checkout */
249
250 #define IGNORE_ENV      "CVSIGNORE"     /* More files to ignore */
251 #define WRAPPER_ENV     "CVSWRAPPERS"   /* name of the wrapper file */
252
253 #define CVSUMASK_ENV    "CVSUMASK"      /* Effective umask for repository */
254 /* #define      CVSUMASK_DFLT              Set by config.h */
255
256 /*
257  * If the beginning of the Repository matches the following string, strip it
258  * so that the output to the logfile does not contain a full pathname.
259  *
260  * If the CVSROOT environment variable is set, it overrides this define.
261  */
262 #define REPOS_STRIP     "/master/"
263
264 /*
265  * The maximum number of files per each CVS directory. This is mainly for
266  * sizing arrays statically rather than dynamically.  3000 seems plenty for
267  * now.
268  */
269 #define MAXFILEPERDIR   3000
270 #define MAXLINELEN      5000            /* max input line from a file */
271 #define MAXPROGLEN      30000           /* max program length to system() */
272 #define MAXLISTLEN      40000           /* For [A-Z]list holders */
273 #define MAXDATELEN      50              /* max length for a date */
274
275 /* structure of a entry record */
276 struct entnode
277 {
278     char *user;
279     char *version;
280     char *timestamp;
281     char *options;
282     char *tag;
283     char *date;
284     char *conflict;
285 };
286 typedef struct entnode Entnode;
287
288 /* The type of request that is being done in do_module() */
289 enum mtype
290 {
291     CHECKOUT, TAG, PATCH, EXPORT
292 };
293
294 /*
295  * defines for Classify_File() to determine the current state of a file.
296  * These are also used as types in the data field for the list we make for
297  * Update_Logfile in commit, import, and add.
298  */
299 enum classify_type
300 {
301     T_UNKNOWN = 1,                      /* no old-style analog existed   */
302     T_CONFLICT,                         /* C (conflict) list             */
303     T_NEEDS_MERGE,                      /* G (needs merging) list        */
304     T_MODIFIED,                         /* M (needs checked in) list     */
305     T_CHECKOUT,                         /* O (needs checkout) list       */
306     T_ADDED,                            /* A (added file) list           */
307     T_REMOVED,                          /* R (removed file) list         */
308     T_REMOVE_ENTRY,                     /* W (removed entry) list        */
309     T_UPTODATE,                         /* File is up-to-date            */
310 #ifdef SERVER_SUPPORT
311     T_PATCH,                            /* P Like C, but can patch       */
312 #endif
313     T_TITLE                             /* title for node type           */
314 };
315 typedef enum classify_type Ctype;
316
317 /*
318  * a struct vers_ts contains all the information about a file including the
319  * user and rcs file names, and the version checked out and the head.
320  *
321  * this is usually obtained from a call to Version_TS which takes a tag argument
322  * for the RCS file if desired
323  */
324 struct vers_ts
325 {
326     /* rcs version user file derives from, from CVS/Entries.
327      * it can have the following special values:
328      *    empty = no user file
329      *    0 = user file is new
330      *    -vers = user file to be removed.  */
331     char *vn_user;
332
333     /* Numeric revision number corresponding to ->vn_tag (->vn_tag
334        will often be symbolic).  */
335     char *vn_rcs;
336     /* If ->tag corresponds to a tag which really exists in this file,
337        this is just a copy of ->tag.  If not, this is either NULL or
338        the head revision.  (Or something like that, see RCS_getversion
339        and friends).  */
340     char *vn_tag;
341
342     /* This is the timestamp from stating the file in the working directory.
343        It is NULL if there is no file in the working directory.  */
344     char *ts_user;
345     /* Timestamp from CVS/Entries.  For the server, ts_user and ts_rcs
346        are computed in a slightly different way, but the fact remains that
347        if they are equal the file in the working directory is unmodified
348        and if they differ it is modified.  */
349     char *ts_rcs;
350
351     /* Options from CVS/Entries (keyword expansion).  */
352     char *options;
353
354     /* If non-NULL, there was a conflict (or merely a merge?  See merge_file)
355        and the time stamp in this field is the time stamp of the working
356        directory file which was created with the conflict markers in it.
357        This is from CVS/Entries.  */
358     char *ts_conflict;
359
360     /* Tag specified on the command line, or if none, tag stored in
361        CVS/Entries.  */
362     char *tag;
363     /* Date specified on the command line, or if none, date stored in
364        CVS/Entries.  */
365     char *date;
366
367     /* Pointer to entries file node  */
368     Entnode *entdata;
369
370     /* Pointer to parsed src file info */
371     RCSNode *srcfile;
372 };
373 typedef struct vers_ts Vers_TS;
374
375 /*
376  * structure used for list-private storage by Entries_Open() and
377  * Version_TS().
378  */
379 struct stickydirtag
380 {
381     int aflag;
382     char *tag;
383     char *date;
384     char *options;
385 };
386
387 /* Flags for find_{names,dirs} routines */
388 #define W_LOCAL                 0x01    /* look for files locally */
389 #define W_REPOS                 0x02    /* look for files in the repository */
390 #define W_ATTIC                 0x04    /* look for files in the attic */
391
392 /* Flags for return values of direnter procs for the recursion processor */
393 enum direnter_type
394 {
395     R_PROCESS = 1,                      /* process files and maybe dirs */
396     R_SKIP_FILES,                       /* don't process files in this dir */
397     R_SKIP_DIRS,                        /* don't process sub-dirs */
398     R_SKIP_ALL                          /* don't process files or dirs */
399 };
400 typedef enum direnter_type Dtype;
401
402 extern char *program_name, *program_path, *command_name;
403 extern char *Rcsbin, *Editor, *CVSroot;
404 extern char *CVSADM_Root;
405 extern int cvsadmin_root;
406 extern char *CurDir;
407 extern int really_quiet, quiet;
408 extern int use_editor;
409 extern int cvswrite;
410 extern mode_t cvsumask;
411
412 extern int trace;               /* Show all commands */
413 extern int noexec;              /* Don't modify disk anywhere */
414 extern int logoff;              /* Don't write history entry */
415
416 extern char hostname[];
417
418 /* Externs that are included directly in the CVS sources */
419
420 int RCS_settag PROTO((const char *, const char *, const char *));
421 int RCS_deltag PROTO((const char *, const char *, int));
422 int RCS_setbranch PROTO((const char *, const char *));
423 int RCS_lock PROTO((const char *, const char *, int));
424 int RCS_unlock PROTO((const char *, const char *, int));
425 int RCS_merge PROTO((const char *, const char *, const char *, const char *));
426 int RCS_checkout PROTO ((char *rcsfile, char *workfile, char *tag,
427                          char *options,
428                          char *sout, int flags, int noerr));
429 /* Flags used by RCS_* functions.  See the description of the individual
430    functions for which flags mean what for each function.  */
431 #define RCS_FLAGS_LOCK 1
432 #define RCS_FLAGS_FORCE 2
433 #define RCS_FLAGS_DEAD 4
434 #define RCS_FLAGS_QUIET 8
435 #define RCS_FLAGS_MODTIME 16
436 int RCS_checkin PROTO ((char *rcsfile, char *workfile, char *message,
437                         char *rev, int flags, int noerr));
438
439 \f
440
441 #include "error.h"
442
443 DBM *open_module PROTO((void));
444 FILE *open_file PROTO((const char *, const char *));
445 List *Find_Directories PROTO((char *repository, int which));
446 void Entries_Close PROTO((List *entries));
447 List *Entries_Open PROTO((int aflag));
448 char *Make_Date PROTO((char *rawdate));
449 char *Name_Repository PROTO((char *dir, char *update_dir));
450 char *Name_Root PROTO((char *dir, char *update_dir));
451 void Create_Root PROTO((char *dir, char *rootdir));
452 int same_directories PROTO((char *dir1, char *dir2));
453 char *Short_Repository PROTO((char *repository));
454 char *gca PROTO((char *rev1, char *rev2));
455 char *getcaller PROTO((void));
456 char *time_stamp PROTO((char *file));
457 char *xmalloc PROTO((size_t bytes));
458 void *xrealloc PROTO((void *ptr, size_t bytes));
459 char *xstrdup PROTO((const char *str));
460 void strip_trailing_newlines PROTO((char *str));
461 int No_Difference PROTO((char *file, Vers_TS * vers, List * entries,
462                          char *repository, char *update_dir));
463 typedef int (*CALLPROC) PROTO((char *repository, char *value));
464 int Parse_Info PROTO((char *infofile, char *repository, CALLPROC callproc, int all));
465 int Reader_Lock PROTO((char *xrepository));
466 typedef RETSIGTYPE (*SIGCLEANUPPROC)    PROTO(());
467 int SIG_register PROTO((int sig, SIGCLEANUPPROC sigcleanup));
468 int Writer_Lock PROTO((List * list));
469 int isdir PROTO((const char *file));
470 int isfile PROTO((const char *file));
471 int islink PROTO((const char *file));
472 int isreadable PROTO((const char *file));
473 int iswritable PROTO((const char *file));
474 int isaccessible PROTO((const char *file, const int mode));
475 int isabsolute PROTO((const char *filename));
476 char *last_component PROTO((char *path));
477 char *get_homedir PROTO ((void));
478
479 int numdots PROTO((const char *s));
480 int unlink_file PROTO((const char *f));
481 int link_file PROTO ((const char *from, const char *to));
482 int unlink_file_dir PROTO((const char *f));
483 int update PROTO((int argc, char *argv[]));
484 int xcmp PROTO((const char *file1, const char *file2));
485 int yesno PROTO((void));
486 void *valloc PROTO((size_t bytes));
487 time_t get_date PROTO((char *date, struct timeb *now));
488 void Create_Admin PROTO((char *dir, char *update_dir,
489                          char *repository, char *tag, char *date));
490 \f
491 void Lock_Cleanup PROTO((void));
492
493 /* Writelock an entire subtree, well the part specified by ARGC, ARGV, LOCAL,
494    and AFLAG, anyway.  */
495 void lock_tree_for_write PROTO ((int argc, char **argv, int local, int aflag));
496
497 /* Remove locks set by lock_tree_for_write.  Currently removes readlocks
498    too.  */
499 void lock_tree_cleanup PROTO ((void));
500 \f
501 void ParseTag PROTO((char **tagp, char **datep));
502 void Scratch_Entry PROTO((List * list, char *fname));
503 void WriteTag PROTO((char *dir, char *tag, char *date));
504 void cat_module PROTO((int status));
505 void check_entries PROTO((char *dir));
506 void close_module PROTO((DBM * db));
507 void copy_file PROTO((const char *from, const char *to));
508 void (*error_set_cleanup PROTO((void (*) (void)))) PROTO ((void));
509 void fperror PROTO((FILE * fp, int status, int errnum, char *message,...));
510 void free_names PROTO((int *pargc, char *argv[]));
511 void freevers_ts PROTO((Vers_TS ** versp));
512
513 extern int ign_name PROTO ((char *name));
514 void ign_add PROTO((char *ign, int hold));
515 void ign_add_file PROTO((char *file, int hold));
516 void ign_setup PROTO((void));
517 void ign_dir_add PROTO((char *name));
518 int ignore_directory PROTO((char *name));
519 typedef void (*Ignore_proc) PROTO ((char *, char *));
520 extern void ignore_files PROTO ((List *, char *, Ignore_proc));
521 extern int ign_inhibit_server;
522 extern int ign_case;
523
524 #include "update.h"
525
526 void line2argv PROTO((int *pargc, char *argv[], char *line));
527 void make_directories PROTO((const char *name));
528 void make_directory PROTO((const char *name));
529 void rename_file PROTO((const char *from, const char *to));
530 /* Expand wildcards in each element of (ARGC,ARGV).  This is according to the
531    files which exist in the current directory, and accordingly to OS-specific
532    conventions regarding wildcard syntax.  It might be desirable to change the
533    former in the future (e.g. "cvs status *.h" including files which don't exist
534    in the working directory).  The result is placed in *PARGC and *PARGV;
535    the *PARGV array itself and all the strings it contains are newly
536    malloc'd.  It is OK to call it with PARGC == &ARGC or PARGV == &ARGV.  */
537 extern void expand_wild PROTO ((int argc, char **argv, 
538                                 int *pargc, char ***pargv));
539
540 void strip_path PROTO((char *path));
541 void strip_trailing_slashes PROTO((char *path));
542 void update_delproc PROTO((Node * p));
543 void usage PROTO((const char *const *cpp));
544 void xchmod PROTO((char *fname, int writable));
545 char *xgetwd PROTO((void));
546 int Checkin PROTO((int type, char *file, char *update_dir,
547                    char *repository, char *rcs, char *rev,
548                    char *tag, char *options, char *message, List *entries));
549 Ctype Classify_File PROTO((char *file, char *tag, char *date, char *options,
550                      int force_tag_match, int aflag, char *repository,
551                      List *entries, RCSNode *rcsnode, Vers_TS **versp,
552                      char *update_dir, int pipeout));
553 List *Find_Names PROTO((char *repository, int which, int aflag,
554                   List ** optentries));
555 void Register PROTO((List * list, char *fname, char *vn, char *ts,
556                char *options, char *tag, char *date, char *ts_conflict));
557 void Update_Logfile PROTO((char *repository, char *xmessage, char *xrevision,
558                      FILE * xlogfp, List * xchanges));
559 Vers_TS *Version_TS PROTO((char *repository, char *options, char *tag,
560                      char *date, char *user, int force_tag_match,
561                      int set_time, List * entries, RCSNode * rcs));
562 void do_editor PROTO((char *dir, char **messagep,
563                       char *repository, List * changes));
564
565 typedef int (*CALLBACKPROC)     PROTO((int *pargc, char *argv[], char *where,
566         char *mwhere, char *mfile, int horten, int local_specified,
567         char *omodule, char *msg));
568
569 /* This is the structure that the recursion processor passes to the
570    fileproc to tell it about a particular file.  */
571 struct file_info
572 {
573     /* Name of the file, without any directory component.  */
574     char *file;
575
576     /* Name of the directory we are in, relative to the directory in
577        which this command was issued.  We have cd'd to this directory
578        (either in the working directory or in the repository, depending
579        on which sort of recursion we are doing).  If we are in the directory
580        in which the command was issued, this is "".  */
581     char *update_dir;
582
583     /* update_dir and file put together, with a slash between them as
584        necessary.  This is the proper way to refer to the file in user
585        messages.  */
586     char *fullname;
587
588     /* Name of the directory corresponding to the repository which contains
589        this file.  */
590     char *repository;
591
592     /* The pre-parsed entries for this directory.  */
593     List *entries;
594
595     RCSNode *rcs;
596 };
597
598 typedef int (*FILEPROC)         PROTO((struct file_info *finfo));
599 typedef int (*FILESDONEPROC)    PROTO((int err, char *repository, char *update_dir));
600 typedef Dtype (*DIRENTPROC)     PROTO((char *dir, char *repos, char *update_dir));
601 typedef int (*DIRLEAVEPROC)     PROTO((char *dir, int err, char *update_dir));
602
603 extern int mkmodules PROTO ((char *dir));
604 extern int init PROTO ((int argc, char **argv));
605
606 int do_module PROTO((DBM * db, char *mname, enum mtype m_type, char *msg,
607                 CALLBACKPROC callback_proc, char *where, int shorten,
608                 int local_specified, int run_module_prog, char *extra_arg));
609 int do_recursion PROTO((FILEPROC xfileproc, FILESDONEPROC xfilesdoneproc,
610                   DIRENTPROC xdirentproc, DIRLEAVEPROC xdirleaveproc,
611                   Dtype xflags, int xwhich, int xaflag, int xreadlock,
612                   int xdosrcs));
613 void history_write PROTO((int type, char *update_dir, char *revs, char *name,
614                     char *repository));
615 int start_recursion PROTO((FILEPROC fileproc, FILESDONEPROC filesdoneproc,
616                      DIRENTPROC direntproc, DIRLEAVEPROC dirleaveproc,
617                      int argc, char *argv[], int local, int which,
618                      int aflag, int readlock, char *update_preload,
619                      int dosrcs, int wd_is_repos));
620 void SIG_beginCrSect PROTO((void));
621 void SIG_endCrSect PROTO((void));
622 void read_cvsrc PROTO((int *argc, char ***argv, char *cmdname));
623
624 char *make_message_rcslegal PROTO((char *message));
625
626 /* flags for run_exec(), the fast system() for CVS */
627 #define RUN_NORMAL              0x0000  /* no special behaviour */
628 #define RUN_COMBINED            0x0001  /* stdout is duped to stderr */
629 #define RUN_REALLY              0x0002  /* do the exec, even if noexec is on */
630 #define RUN_STDOUT_APPEND       0x0004  /* append to stdout, don't truncate */
631 #define RUN_STDERR_APPEND       0x0008  /* append to stderr, don't truncate */
632 #define RUN_SIGIGNORE           0x0010  /* ignore interrupts for command */
633 #define RUN_TTY         (char *)0       /* for the benefit of lint */
634
635 void run_arg PROTO((const char *s));
636 void run_print PROTO((FILE * fp));
637 #ifdef HAVE_VPRINTF
638 void run_setup PROTO((const char *fmt,...));
639 void run_args PROTO((const char *fmt,...));
640 #else
641 void run_setup ();
642 void run_args ();
643 #endif
644 int run_exec PROTO((char *stin, char *stout, char *sterr, int flags));
645
646 /* other similar-minded stuff from run.c.  */
647 FILE *run_popen PROTO((const char *, const char *));
648 int piped_child PROTO((char **, int *, int *));
649 void close_on_exec PROTO((int));
650 int filter_stream_through_program PROTO((int, int, char **, pid_t *));
651
652 pid_t waitpid PROTO((pid_t, int *, int));
653 \f
654 /* Wrappers.  */
655
656 typedef enum { WRAP_MERGE, WRAP_COPY } WrapMergeMethod;
657 typedef enum { WRAP_TOCVS, WRAP_FROMCVS, WRAP_CONFLICT } WrapMergeHas;
658
659 void  wrap_setup PROTO((void));
660 int   wrap_name_has PROTO((const char *name,WrapMergeHas has));
661 char *wrap_tocvs_process_file PROTO((const char *fileName));
662 int   wrap_merge_is_copy PROTO((const char *fileName));
663 char *wrap_fromcvs_process_file PROTO((const char *fileName));
664 void wrap_add_file PROTO((const char *file,int temp));
665 void wrap_add PROTO((char *line,int temp));
666 \f
667 /* Pathname expansion */
668 char *expand_path PROTO((char *name, char *file, int line));
669
670 /* User variables.  */
671 extern List *variable_list;
672
673 extern void variable_set PROTO ((char *nameval));
674 \f
675 int watch PROTO ((int argc, char **argv));
676 int edit PROTO ((int argc, char **argv));
677 int unedit PROTO ((int argc, char **argv));
678 int editors PROTO ((int argc, char **argv));
679 int watchers PROTO ((int argc, char **argv));
680 extern int annotate PROTO ((int argc, char **argv));
681 \f
682 #if defined(AUTH_CLIENT_SUPPORT) || defined(AUTH_SERVER_SUPPORT)
683 char *scramble PROTO ((char *str));
684 char *descramble PROTO ((char *str));
685 #endif /* AUTH_CLIENT_SUPPORT || AUTH_SERVER_SUPPORT */
686
687 extern void tag_check_valid PROTO ((char *, int, char **, int, int, char *));
688 \f
689 extern void cvs_output PROTO ((char *, size_t));
690 extern void cvs_outerr PROTO ((char *, size_t));