home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / COMPUPD.ZIP / READ.ME < prev    next >
Text File  |  1988-11-24  |  10KB  |  263 lines

  1.                    COMPARE.C
  2.                 UPDATE.C
  3.  
  4.       Copyright (C) Seven Valleys Software 1985,1987,1988
  5.      Written for Seven Valleys Software by Cheyenne Wills &
  6.             Released For Public Distribution
  7.               All Rights Reserved
  8.  
  9.   Permission is granted to freely distribute this code, but not for
  10. profit, provided that this notice and the following disclaimer are
  11. included in their entirety and without modifications of any sort.  This
  12. work may not be sold, or modified and sold, or included in any other
  13. work to be sold, (except for a nominal media charge), without the
  14. written permission of the author.
  15.  
  16.   Permission is granted to modify the source code and distribute it in
  17. modified form PROVIDED that the authors of any modifications identify
  18. themselves with name and address following this header and that all such
  19. modifications are clearly indicated as to location and purpose, with
  20. descriptive comments that clearly indicate modified lines.
  21.  
  22.   The author would appreciate hearing of any modifications that may be
  23. made, but makes no guarantees that such modifications will be
  24. distributed with future releases of this program.
  25.  
  26. Author's address:
  27.  
  28.     Cheyenne C. Wills
  29.     12 West Locust St.
  30.     Mechanicsburg, Pa. 17055
  31.     (717) 697-5198
  32.  
  33.     Written for
  34.     Seven Valley's Software
  35.     P.O. Box 99
  36.     Glen Rock, Pa 17327
  37.  
  38. Disclaimer:
  39.  
  40.   No guarantees or warranties of any kind: This code is distributed
  41. "AS IS" without any warranty of any kind, either expressed or implied,
  42. including, but not limited to the implied warranties of merchantability
  43. and fitness for a particular purpose.  You are soley responsible for the
  44. selection of the program to achieve your intended results and for the
  45. results actually obtained.  Should the program prove defective, you (and
  46. not the author) assume the entire cost of all necessary servicing,
  47. repair, or correction.
  48.  
  49.   Neither the author nor anyone else who has been involved in the
  50. creation, production or delivery of this program shall be liable for any
  51. direct, indirect, consequential or incidental damages arising out of the
  52. use or inability to use this program.
  53. -------------------------------------------------------------------------------
  54.  
  55. Manifest:
  56.  
  57. compupdt.arc
  58.     read.me     - this file
  59.     compare.exe    - text file compare utility
  60.     update.exe    - merges a base file and "update" files
  61.     compare.c    - source code for compare utility
  62.     update.c    - source code for update utility
  63.     makefile    - makefile used for creating compare.exe and
  64.               update.exe
  65.  
  66. Notes:
  67.  
  68. Both the .EXE files will run in OS/2 and MSDOS (ie they have been bound
  69. with the family API library).
  70.  
  71. The makefile may not work with Microsoft's MAKE utility.  I have another
  72. MAKE utility that works more like AT&T's UNIX MAKE.
  73.  
  74. -------------------------------------------------------------------------------
  75.                 Overview
  76.  
  77. The compare and update utilities were designed to provide a facility to
  78. help maintain source code files.  They were patterned off the UPDATE
  79. factility provided by IBM's VM system.  Given two "levels" of a file,
  80. the compare utility can generate an "update" file that describes the
  81. changes that have to be made to the first level to bring it up to the
  82. same level as the second file.    The update utility takes a base level
  83. of a file, and either a single update file or a list of update files and
  84. applies all the requested changes.  The smallest "unit" that compare and
  85. update work with is a line.  This means that if you change a word then
  86. the entire line will be marked as changed.
  87.  
  88. Instead of creating an update file, the compare utility can generate a
  89. report of the differences between the two files.  This facility is very
  90. handy (in fact it is the default operation of compare) and will be the
  91. mode you will probably use the most.  Again the smallest "unit" of
  92. change is a line.
  93.  
  94.                   UPDATE Facility
  95.  
  96. The update facility is based around a concept of a base file that once
  97. it is created will not be changed, and update files that describe (to
  98. the update utility) the changes required to go from one level of changes
  99. to another.
  100.  
  101. An important concept that the update facility uses are "sequence
  102. numbers".  When you create the base file, each line will be assigned a
  103. number.  When you apply an update to the base,    the update file contains
  104. control statements that match these sequence numbers.  An example might
  105. best explain the concept.
  106.  
  107. Example:
  108.     Seq Nums   ---- BASE ----
  109.            +--------------------------------------------+
  110.     [0010000]  |#include <stdio.h>                |
  111.     [0020000]  |main(argc,argv)                |
  112.     [0030000]  |int argc; char **argv;            |
  113.     [0040000]  |{                        |
  114.     [0050000]  |    printf("%d\n",argc);                    |
  115.     [0060000]  |}                        |
  116.            +--------------------------------------------+
  117.            --- Update for creating level1 ---
  118.            +--------------------------------------------+
  119.            |./ R 30000 50000 $ 36000 6000        |
  120.            |int argc;                    |
  121.            |char **argv;                |
  122.            |{                        |
  123.            |printf("The number of args = %d\n",argc);   |
  124.            +--------------------------------------------+
  125.     Seq Nums   --- LEVEL1 ---
  126.            +--------------------------------------------+
  127.     [0010000]  |#include <stdio.h>                |
  128.     [0020000]  |main(argc,argv)                |
  129.     [0036000]  |int argc;                    |
  130.     [0042000]  |char **argv;                |
  131.     [0048000]  |{                        |
  132.     [0054000]  |printf("The number of args = %d\n",argc);   |
  133.     [0060000]  |}                        |
  134.            +--------------------------------------------+
  135.  
  136. There are several things to notice in the above example.  First the
  137. sequence numbers are not really added to the file.  Instead they are
  138. assigned by compare and update at execution time.  The starting value
  139. and increment are command line parms.  Second the sequence numbers for
  140. lines that have been changed are replaced with a new sequence number.
  141. The new number will not have the same value has the original.  This is
  142. to prevent applying updates that hit the same line(s) out of order.  The
  143. third thing is that the assigning of the sequence numbers must be
  144. consistant between one invocation of compare/update and the next.
  145. Otherwise the updates might get placed on the wrong lines.
  146.  
  147.                UPDATE control statements
  148.  
  149. The following is a list of the UPDATE control statements.
  150.  
  151.  
  152. ./ D seqno1 [seqno2]
  153. Deletes lines from seqno1 upto and including seqno2.  Seqno1 is
  154. required, seqno2 defaults to seqno1 (thus deleting only that line)
  155. The next line in the update file must be a valid update control record.
  156.  
  157.  
  158. ./ I seqno [$ [seqstrt [seqincr]]]
  159. Inserts lines following seqno.    The dollar sign is an indicator that
  160. there could be two more options.  The seqstrt (default is seqno+100) is
  161. the sequence number value of the first inserted line.  Seqincr (default
  162. is 100) is the increment to be added to get the next sequence number.
  163.  
  164. ./ R seqno1 [seqno2] [$ [seqstrt [seqincr]]]
  165. Replaces lines starting at seqno1 upto and including seqno2.  The
  166. default for seqno2 is seqno1.  Seqstrt and seqincr have the same meaning
  167. as in the insert statement.
  168.  
  169. ./ S seqstrt seqincr
  170. Resequences the file.    If specified - it must be the first control
  171. statement in the file.    Seqstrt is the starting sequence number, seqincr
  172. is the value added to the current sequence number to produce the next
  173. one.  Default for seqstrt is 10000 and the default for seqincr is
  174. seqstrt.
  175.  
  176. ./ * [comment]
  177. Comment cards..
  178.  
  179.  
  180. -------------------------------------------------------------------------------
  181.                 Command formats
  182.  
  183. COMPARE <file1> <file2> [options]
  184.  
  185. Where:
  186.  
  187. <file1> and <file2> are the two files to be compared
  188.  
  189. [options] are:
  190.  
  191. -l [<listing>]    Generate output to file
  192.         <listing> defaults to COMPARE.LST
  193. -w        Ignore white space between 'words'
  194. -t        Ignore case
  195. -p        Generate output to the printer
  196. -mn        Resync on n lines (default is 2)
  197. -cx,y        Only compare cols x thru y
  198.  
  199. ------------ following for update deck generation only ------------
  200. -u [<update deck>] Generate update deck to make file1 into file2
  201.         <update deck> defaults to the <name of file1>."UPT"
  202. -sx,y        Generate internal sequence numbers starting with x
  203.         and increment by y. Default if -s is omitted is 1,1
  204.         if -s is specified with out x and y then x=10000
  205.         y defaults to x
  206. -x        File1 already contains sequence numbers
  207. ------------ following for aide with editor shells only -----------
  208. -i        Use a sequence file (generated from UPDATE command)
  209.         name is <name of file1>."SEQ"
  210.         will be deleted
  211.  
  212. UPDATE <file1> <file2> [<file3>] [options]
  213. Where:
  214.     <file1> is the name of the file to be updated
  215.     <file2> is the name of the delta deck
  216.     <file3> is the name of the output file (defaults to $<file1>)
  217.  
  218. [options]
  219.  
  220.     -p       Print a brief update log to PRN
  221.     -pf    Print a Full log (each update is listed) to PRN
  222.  
  223.     -l [<file>]    List a brief update log to <file> (default is UPDATE.LOG)
  224.     -lf [<file>]   List a Full update log to <file> (default is UPDATE.LOG)
  225.  
  226.     -s[S,I]    Generates sequences numbers starting with S and incremented
  227.            by I.  S defaults to 10000 and I defaults to S.
  228.  
  229. ---- The following options control if the sequence numbers already
  230. ---- exist in the input file.
  231.     -xi        Input file contains sequence numbers as the first "word"
  232.            of each line. (ex: 10000 10 rem fist line).
  233.     -xio[S,I]  Input file contains sequence numbers as the first "word"
  234.            output file will also contain sequence numbers as the
  235.            first word.  If S is specified, then the output will
  236.            be resequenced starting with S.    I (the increment)
  237.            defaults to S.
  238.     -xo[S,I]   Resequence the output file.
  239.  
  240.     -c           Control file.  <file2> is the name of a control file
  241.            <file1> is the name of the output file.
  242.            <file3> is unused.
  243.            Each line of the control file contains as its
  244.            first "word" the extension of an input file.
  245.            the first line must be the extension of base file.
  246.            ex:
  247.            >> DIR SAMP.* ->
  248.             SAMP.CTL
  249.             SAMP.V00
  250.             SAMP.V01
  251.            +---------------COMPARE.CTL-------------------+
  252.            | V00 Base of SAMP.C                 |
  253.            | V01 Add -i option and online doc         |
  254.            +---------------------------------------------+
  255.            To generate SAMP.C
  256.            UPDATE SAMP.C SAMP.CTL -c
  257.  
  258. ------------ following for aid with editor shells only -----------
  259.     -i           Generate a sequence file to be used by COMPARE
  260.            on the last pass generate a external sequence file.
  261.  
  262.  
  263.