home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / turbo_c / tc2pat2.zip / PATCH.DOC < prev    next >
Text File  |  1988-10-13  |  4KB  |  80 lines

  1. PATCH.COM
  2.  
  3. Syntax: patch [-u] [-v#] dif_file prog_file [out_file]
  4.  
  5. PATCH.COM reads the text from dif_file and applies the patch to prog_file.
  6. The diff file is relatively free format. Any number of spaces or tabs can
  7. appear between two values, and any number of spaces, tabs, and blank lines
  8. can appear between lines.  The file consists of zero or more pairs of lines
  9. in the following format:
  10.  
  11.    offset: newbyte [newbyte ...]
  12.            oldbyte [oldbyte ...]
  13.  
  14. All values are represented in the file using hexidecimal digits.  The value
  15. of offset can range from 0 to 7FFFFFFF hex.  The values of new and old bytes
  16. can range from 0 to FF hex.  Comments can be inserted in the file by starting
  17. a new line with a semicolon (;).
  18.  
  19. ----------------------------------- Example --------------------------------
  20. ; Example patch file
  21.     6:  88
  22.         85
  23.  1DEE:  74 1A 52 7F FF 77 00
  24.         73 00 1A 52 7F ff 77
  25. ; notice the free format
  26. 03636: 053 08  5B     19 71 8  5B    19
  27.  
  28. 00 00   00 00 00 00  00 0
  29. ----------------------------------------------------------------------------
  30.  
  31. As you can see from the first two pairs, the diff file is more readable when
  32. formatted nicely.  But, you can be pretty flexible as shown in the third
  33. pair of lines.  Note: The first line of each pair contains the new byte values
  34. while the second line contains the old byte values.
  35.  
  36. When applying a patch, PATCH.COM makes a first pass to check that all bytes
  37. in the file which will be changed, currently match the old values which are
  38. defined in dif_file.  If they don't, an error message is printed and the
  39. patch is not applied.  If they do match, all the corresponding bytes are
  40. changed to their new values.  If any error occurs during this second step,
  41. it is most likely an out of disk space error.  During the update, a backup
  42. copy of your original file (.BAK) is kept.  This means you need twice as
  43. much disk space if your input and output files are on the same disk drive.
  44. In case of an error, the temporary file is usually deleted and the .BAK file
  45. is renamed back to the original name.  If something else goes wrong, like a
  46. power outage, you should still have your original file on the disk with a
  47. .BAK extension.
  48.  
  49. After the patch is completed:
  50.   If the output file is the same as the input file, the .BAK file is deleted.
  51.   If the output file is different than the input file, the .BAK file is
  52.   renamed back to its original name.
  53.  
  54. The -u option cause PATCH.COM to undo the patch defined in dif_file.  In this
  55. case, it checks that all the bytes to be modified match the new byte values
  56. on the first line of each pair.  It then changes the corresponding bytes to
  57. the old byte values defined on the second line of each pair.
  58.  
  59. The -v option is used to specify which system interrupt vector is used for
  60. patches.  System interrupt vector 18H (hex) is used.  In rare circumstances,
  61. this vector is already being used by the hardware and is not available.
  62. In those situations you must use this option to override this default value.
  63. The next best choice is 60H (e.g. -v60).  If this still does not work,
  64. please contact technical support for assistance.  Whatever number you chose,
  65. you must ALWAYS use the same vector number when installing patches to a
  66. program file.
  67.  
  68. The last parameter (out_file) is optional.  If defined, the patched version
  69. of the original file will be saved under the name specified by out_file, and
  70. the original file will be left intact.  If it is not specified, the patched
  71. version of the file will have the same name as the original version of the
  72. file, and the original version of the file will be lost.
  73.  
  74. Note:  Because PATCH.COM checks the old values of each byte to be patched,
  75. two or more patches which affect the same byte must be applied in order.
  76. Also, because of the fixed offsets defined in dif_file, the same dif_file will
  77. probably not be usable with multiple versions of the program file being
  78. patched.
  79. 
  80.