home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / rcs / sources / cvs.h < prev    next >
C/C++ Source or Header  |  1992-02-23  |  7KB  |  219 lines

  1. /*    $Id: cvs.h,v 1.24.1.1 91/01/18 12:13:48 berliner Exp $    */
  2.  
  3. #include <string.h>
  4. #include <stdio.h>
  5. #include <time.h>
  6. #include <direct.h>
  7. #include "ndbm.h"
  8. #include "regex.h"
  9.  
  10. #ifdef OS2
  11. /* OS/2 can generally use / too, but not in some places when commands
  12.  * are passed to CMD.EXE for execution (i.e. I/O redirection). */
  13. #define DIRSEP           '\\'
  14. #define DIRSEPSTR        "\\"
  15. #define ISDIRSEP(c)      ((c) == DIRSEP || (c) == '/')
  16. extern char *index_sep(char *);
  17. extern char *rindex_sep(char *);
  18. #define system(c)        (flushall(),system(c))
  19. #else
  20. #define DIRSEP           '/'
  21. #define DIRSEPSTR        "/"
  22. #define ISDIRSEP(c)      ((c) == DIRSEP)
  23. #define index_sep(p)     index(p, DIRSEP)
  24. #define rindex_sep(p)    rindex(p, DIRSEP)
  25. #define stricmp          strcmp
  26. #define strnicmp         strncmp
  27. #endif
  28.  
  29. /*
  30.  *    Copyright (c) 1989, Brian Berliner
  31.  *
  32.  *    You may distribute under the terms of the GNU General Public License
  33.  *    as specified in the README file that comes with the CVS 1.0 kit.
  34.  *
  35.  * Definitions for the CVS Administrative directory and
  36.  * the files it contains.  Here as #define's to make changing
  37.  * the names a simple task.
  38.  */
  39. #define    CVSADM        "CVS.adm"
  40. #define    CVSEXT_OPT    "CVS.opt"
  41. #define    CVSEXT_LOG    "CVS.log"
  42.  
  43. #define    CVSADM_ENT    "CVS.adm/Entries"
  44. #define    CVSADM_ENTBAK    "CVS.adm/Entries.Bak"
  45. #define    CVSADM_ENTSTAT    "CVS.adm/Entries.Sta"
  46. #define    CVSADM_FILE    "CVS.adm/Files"
  47. #define    CVSADM_MOD    "CVS.adm/Mod"
  48. #define    CVSADM_REP    "CVS.adm/Reposit.ory"
  49. #define    CVSADM_CIPROG    "CVS.adm/Checkin.prg"
  50.  
  51. /*
  52.  * Definitions for the CVSROOT Administrative directory and
  53.  * the files it contains.  This directory is created as a
  54.  * sub-directory of the $CVSROOT environment variable, and holds
  55.  * global administration information for the entire source
  56.  * repository beginning at $CVSROOT.
  57.  */
  58. #define    CVSROOTADM        "CVSROOT.adm"
  59. #define    CVSROOTADM_MODULES    "CVSROOT.adm/modules"
  60. #define    CVSROOTADM_LOGINFO    "CVSROOT.adm/loginfo"
  61.  
  62. /* support for the CVSROOTADM files */
  63. #define    CVSMODULE_FILE    "modules" /* last component of CVSROOTADM_MODULES */
  64. #define    CVSMODULE_TMP    "#mXXXXXX"
  65. #define    CVSMODULE_OPTS    "ai:o:t:"
  66. #define    CVSLOGINFO_FILE    "loginfo" /* last component of CVSROOTADM_LOGINFO */
  67. #define    CVSLOGINFO_TMP    "#lXXXXXX"
  68.  
  69. /* Other CVS file names */
  70. #define    CVSATTIC    "Attic"
  71. #define    CVSLCK        "#cvs_lck"
  72. #define    CVSTFL        "#tfl"
  73. #define    CVSRFL        "#rfl"
  74. #define    CVSWFL        "#wfl"
  75. #define    CVSPREFIX    ""
  76. #define    CVSTEMP        "#cXXXXXX"
  77.  
  78. /* miscellaneous CVS defines */
  79. #define    CVSEDITPREFIX    "CVS: "
  80. #define    CVSLCKAGE    600        /* 10-min old lock files cleaned up */
  81. #define    CVSLCKSLEEP    15        /* wait 15 seconds before retrying */
  82. #define    DFLT_RECORD    "nul"
  83. #define    BAKPREFIX    "#"
  84.  
  85. #define    DEVNULL        "nul"
  86. #define CONSOLE         "con"  /* or "/dev/tty" */
  87.  
  88. #define    FALSE        0
  89. #define    TRUE        1
  90.  
  91. /*
  92.  * Definitions for the RCS file names.
  93.  */
  94. #define    RCS        "rcs"
  95. #define    RCS_CI        "ci"
  96. #define    RCS_CO        "co"
  97. #define    RCS_RLOG    "rlog"
  98. #define    RCS_DIFF    "rcsdiff"
  99. #define    RCS_MERGE    "rcsmerge"
  100. #define    RCS_MERGE_PAT    "^>>>>>>> "    /* runs "grep" with this pattern */
  101. #define    RCSID_PAT    "\"\\$Id.*\\$\""    /* when committing files */
  102. #define    RCSEXT          Rcsext
  103. #define    RCSHEAD        "head"
  104. #define    RCSBRANCH    "branch"
  105. #define    RCSSYMBOL    "symbols"
  106. #define    RCSDATE        "date"
  107. #define    RCSDESC        "desc"        /* ends the search for branches */
  108. #define    DATEFORM    "%02d.%02d.%02d.%02d.%02d.%02d"
  109.  
  110. /* Programs that cvs runs */
  111. #define    DIFF        "diff"
  112. #define    GREP        "grep"
  113. #define    RM        "rm"
  114. #define    SORT        "sort"
  115.  
  116. /*
  117.  * Environment variable used by CVS
  118.  */
  119. #define    CVSREAD_ENV    "CVSREAD"    /* make files read-only */
  120. #define    CVSREAD_DFLT    FALSE        /* writable files by default */
  121.  
  122. #define    TMPDIR_ENV    "TMP"        /* temp directory */
  123. #define    TMPDIR_DFLT    ""        /* directory to put temp files into */
  124.  
  125. #define    RCSBIN_ENV    "RCSBIN"    /* RCS binary directory */
  126. #define    RCSBIN_DFLT    "/bin"        /* directory to find RCS progs */
  127. #define    RCSINIT_ENV    "RCSINIT"    /* RCS option settings */
  128.  
  129. #define    EDITOR_ENV    "EDITOR"    /* which editor to use */
  130. #define    EDITOR_DFLT    "emacs"     /* somewhat standard */
  131.  
  132. #define    CVSROOT_ENV    "CVSROOT"    /* source directory root */
  133. #define    CVSROOT_DFLT    NULL        /* No dflt; must set for checkout */
  134.  
  135. /*
  136.  * If the beginning of the Repository matches the following string,
  137.  * strip it so that the output to the logfile does not contain a full pathname.
  138.  *
  139.  * If the CVSROOT environment variable is set, it overrides this define.
  140.  */
  141. #define    REPOS_STRIP    "/src/master/"
  142.  
  143. /*
  144.  * The maximum number of files per each CVS directory.
  145.  * This is mainly for sizing arrays statically rather than
  146.  * dynamically.  3000 seems plenty for now.
  147.  */
  148. #define    MAXFILEPERDIR    1000
  149. #define    MAXLINELEN    1000        /* max input line from a file */
  150. #define    MAXPROGLEN    30000        /* max program length to system() */
  151. #define    MAXLISTLEN    10000        /* For [A-Z]list holders */
  152. #define    MAXMESGLEN    1000        /* max RCS log message size */
  153.  
  154. /*
  155.  * The type of request that is being done in do_module() &&
  156.  * the type of request that is being done in Find_Names().
  157.  */
  158. enum mtype { CHECKOUT, TAG, PATCH };
  159. enum ftype { ALL, ALLPLUSATTIC, MOD };
  160.  
  161. extern char *progname, *command;
  162. extern char Clist[], Glist[], Mlist[], Olist[], Dlist[];
  163. extern char Alist[], Rlist[], Wlist[], Llist[], Blist[];
  164. extern char User[], Repository[], SRepository[], Rcs[];
  165. extern char VN_User[], VN_Rcs[], TS_User[], TS_Rcs[];
  166. extern char Options[], Tag[], Date[], prog[];
  167. extern char *Tmpdir, *Rcsbin, *Editor, *CVSroot, *Rcsext;
  168. extern int really_quiet, quiet;
  169. extern int use_editor;
  170. extern int cvswrite;
  171. extern int force_tag_match;
  172.  
  173. extern int fileargc;            /* for Find_Names() */
  174. extern char *fileargv[];
  175.  
  176. /*
  177.  * Externs that are included directly in the CVS sources
  178.  */
  179. extern FILE *open_file();
  180. extern char *xmalloc();
  181. extern int ppstrcmp();
  182. extern int ppstrcmp_files();
  183. extern void Lock_Cleanup();
  184.  
  185. /*
  186.  * Externs that are included in libc, but are used frequently
  187.  * enough to warrant defining here.
  188.  */
  189. extern char *optarg;            /* for getopt() support */
  190. extern int optind;
  191.  
  192. #define DBLKSIZ             1024
  193. #define MAXPATHLEN          256
  194. #define COPYBUFFER          16384
  195.  
  196. #define R_OK                04
  197. #define W_OK                02
  198.  
  199. #define mkstemp(n)          (mktemp(n), open(n, O_CREAT|O_TRUNC|O_RDWR, 0644))
  200. #define getwd(d)            getcwd(d, MAXPATHLEN)
  201. #define geteuid()           0
  202. #define gethostname(n, s)   -1
  203.  
  204. #define max(a,b)        (((a) > (b)) ? (a) : (b))
  205. #define min(a,b)        (((a) < (b)) ? (a) : (b))
  206.  
  207. #define WEXITSTATUS(x)      (x & 255)
  208.  
  209. #define index strchr
  210. #define rindex strrchr
  211.  
  212. #define mkdir(p, m)         mkdir(p)
  213.  
  214. #define bcmp(x, y, n)       memcmp(x, y, n)
  215. #define bcopy(s, d, n)      memcpy(d, s, n)
  216.  
  217. #include "proto.h"
  218.  
  219.