home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / rcs / sources / common.h < prev    next >
C/C++ Source or Header  |  1991-12-24  |  4KB  |  166 lines

  1. /* $Header: common.h,v 2.0.1.2 88/06/22 20:44:53 lwall Locked $
  2.  *
  3.  * $Log:    common.h,v $
  4.  * Revision 2.0.1.2  88/06/22  20:44:53  lwall
  5.  * patch12: sprintf was declared wrong
  6.  *
  7.  * Revision 2.0.1.1  88/06/03  15:01:56  lwall
  8.  * patch10: support for shorter extensions.
  9.  *
  10.  * Revision 2.0  86/09/17  15:36:39  lwall
  11.  * Baseline for netwide release.
  12.  *
  13.  */
  14.  
  15. #define DEBUGGING
  16.  
  17. #define VOIDUSED 7
  18. #include "config.h"
  19.  
  20. /* shut lint up about the following when return value ignored */
  21.  
  22. #define Signal (void)signal
  23. #define Unlink (void)unlink
  24. #define Lseek (void)lseek
  25. #define Fseek (void)fseek
  26. #define Fstat (void)fstat
  27. #define Pclose (void)pclose
  28. #define Close (void)close
  29. #define Fclose (void)fclose
  30. #define Fflush (void)fflush
  31. #define Sprintf (void)sprintf
  32. #define Mktemp (void)mktemp
  33. #define Strcpy (void)strcpy
  34. #define Strcat (void)strcat
  35.  
  36. #include <stdio.h>
  37. #include <assert.h>
  38. #include <sys/types.h>
  39. #include <sys/stat.h>
  40. #include <ctype.h>
  41. #include <signal.h>
  42. #include <io.h>
  43. #include <fcntl.h>
  44.  
  45. /* constants */
  46.  
  47. #define TRUE (1)
  48. #define FALSE (0)
  49.  
  50. #define MAXHUNKSIZE 100000        /* is this enough lines? */
  51. #define INITHUNKMAX 125            /* initial dynamic allocation size */
  52. #define MAXLINELEN 1024
  53. #define BUFFERSIZE 1024
  54. #define SCCSPREFIX "s."
  55. #define GET "get -e %s"
  56. #define RCSSUFFIX ",v"
  57. #define CHECKOUT "co -l %s"
  58.  
  59. #ifdef FLEXFILENAMES
  60. #define ORIGEXT ".orig"
  61. #define REJEXT ".rej"
  62. #else
  63. #define ORIGEXT "~"
  64. #define REJEXT "#"
  65. #endif
  66.  
  67. /* handy definitions */
  68.  
  69. #define Null(t) ((t)0)
  70. #define Nullch Null(char *)
  71. #define Nullfp Null(FILE *)
  72. #define Nulline Null(LINENUM)
  73.  
  74. #define Ctl(ch) ((ch) & 037)
  75.  
  76. #define strNE(s1,s2) (strcmp(s1, s2))
  77. #define strEQ(s1,s2) (!strcmp(s1, s2))
  78. #define strnNE(s1,s2,l) (strncmp(s1, s2, l))
  79. #define strnEQ(s1,s2,l) (!strncmp(s1, s2, l))
  80.  
  81. /* typedefs */
  82.  
  83. typedef char bool;
  84. typedef long LINENUM;            /* must be signed */
  85. typedef unsigned MEM;            /* what to feed malloc */
  86.  
  87. /* globals */
  88.  
  89. EXT int Argc;                /* guess */
  90. EXT char **Argv;
  91. EXT int Argc_last;            /* for restarting plan_b */
  92. EXT char **Argv_last;
  93.  
  94. EXT struct stat filestat;        /* file statistics area */
  95. EXT int filemode INIT(0644);
  96.  
  97. EXT char buf[MAXLINELEN];        /* general purpose buffer */
  98. EXT FILE *ofp INIT(Nullfp);        /* output file pointer */
  99. EXT FILE *rejfp INIT(Nullfp);        /* reject file pointer */
  100.  
  101. EXT bool using_plan_a INIT(TRUE);    /* try to keep everything in memory */
  102. EXT bool out_of_mem INIT(FALSE);    /* ran out of memory in plan a */
  103.  
  104. #define MAXFILEC 2
  105. EXT int filec INIT(0);            /* how many file arguments? */
  106. EXT char *filearg[MAXFILEC];
  107. EXT bool ok_to_create_file INIT(FALSE);
  108. EXT char *bestguess INIT(Nullch);    /* guess at correct filename */
  109.  
  110. EXT char *outname INIT(Nullch);
  111. EXT char rejname[128];
  112.  
  113. EXT char *origext INIT(Nullch);
  114. EXT char *origprae INIT(Nullch);
  115.  
  116. EXT char *TMPOUTNAME;
  117. EXT char *TMPINNAME;
  118. EXT char *TMPREJNAME;
  119. EXT char *TMPPATNAME;
  120. EXT bool toutkeep INIT(FALSE);
  121. EXT bool trejkeep INIT(FALSE);
  122.  
  123. EXT LINENUM last_offset INIT(0);
  124. #ifdef DEBUGGING
  125. EXT int debug INIT(0);
  126. #endif
  127. EXT LINENUM maxfuzz INIT(2);
  128. EXT bool force INIT(FALSE);
  129. EXT bool verbose INIT(TRUE);
  130. EXT bool reverse INIT(FALSE);
  131. EXT bool noreverse INIT(FALSE);
  132. EXT bool skip_rest_of_patch INIT(FALSE);
  133. EXT int strippath INIT(957);
  134. EXT bool canonicalize INIT(FALSE);
  135.  
  136. #define CONTEXT_DIFF 1
  137. #define NORMAL_DIFF 2
  138. #define ED_DIFF 3
  139. #define NEW_CONTEXT_DIFF 4
  140. #define UNI_DIFF 5
  141. EXT int diff_type INIT(0);
  142.  
  143. EXT bool do_defines INIT(FALSE);    /* patch using ifdef, ifndef, etc. */
  144. EXT char if_defined[128];        /* #ifdef xyzzy */
  145. EXT char not_defined[128];        /* #ifndef xyzzy */
  146. EXT char else_defined[] INIT("#else\n");/* #else */
  147. EXT char end_defined[128];        /* #endif xyzzy */
  148.  
  149. EXT char *revision INIT(Nullch);    /* prerequisite revision, if any */
  150.  
  151. void *malloc();
  152. void *realloc();
  153. char *strcpy();
  154. char *strcat();
  155. long atol();
  156. long lseek();
  157. char *mktemp();
  158. #if 0
  159. #ifdef CHARSPRINTF
  160. char *sprintf();
  161. #else
  162. int sprintf();
  163. #endif
  164. #endif
  165. char *getenv();
  166.