home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 October / PCO1097.ISO / FilesBBS / FREI / UTLOS2.ARJ / UTLOS2.ZIP / Doc / CRCCHK.DOC < prev    next >
Encoding:
Text File  |  1997-06-01  |  5.0 KB  |  116 lines

  1. $Id: CRCCHK.DOC 1.2 1997/06/02 00:25:45 brian Exp $
  2.  
  3.                    crcchk.doc : The 'crcchk' command
  4.                           By:  Brian E. Yoder.
  5.                                 06/16/92
  6.  
  7.         (c) Copyright International Business Machines Corporation 1997
  8.         All rights reserved.
  9.  
  10. The crcchk command is used to record the length and CRC value (either
  11. 16-bit or 32-bit) for a list of files.  It can then be used at a later
  12. time to check and see which, if any, of the files has been changed.
  13.  
  14. ========================================================================
  15. Command syntax
  16. ========================================================================
  17.  
  18.         crcchk [ -l ] infile [ outfile ]
  19.  
  20. The program reads the input text file and calcuates the length and CRC
  21. of each file listed.  If the input file also contains a length and CRC
  22. value for a file, then those values are compared against the calculated
  23. values for that file.  This input file can be created by redirecting the
  24. output of the crc command into it (see crc.doc for more information).
  25.  
  26. If an output file name is specified, then each file listed in the input
  27. text file, along with its actual length and CRC, is written to the
  28. output file.  Later, this output file can be read by the crcchk program
  29. to check to see if any of the listed files has changed.
  30.  
  31. The -l (letter el) flag is only used if an output file is specified.
  32.  
  33. ========================================================================
  34. Format of the input text file:
  35. ========================================================================
  36.  
  37.         Blank lines are ignored.  Lines that begin with # are assumed to
  38.         contain comments and are ignored.  Each non-blank, non-comment
  39.         line must be formatted as follows:
  40.  
  41.                 [ length  CRC ]  filename
  42.  
  43.         The length and CRC values are optional.  Either both must be
  44.         present or both must be missing.  If present, the length must be
  45.         specified in decimal, while the CRC must be specified in hex as
  46.         0x followed by one or more hexadecimal digits.
  47.  
  48.         If the CRC is 0xNNNN or shorter (4 or less hex digits), then it
  49.         is assumed to be a 16-bit CRC.  If it contains 5 or more hex
  50.         digits, then it is assumed to be a 32-bit CRC.
  51.  
  52.         If the length and CRC value are present, then crcchk compares
  53.         the values to those it calculated and logs discrepancies to
  54.         stderr.
  55.  
  56. ========================================================================
  57. Format of the output text file:
  58. ========================================================================
  59.  
  60.         If an output file is specified, then crcchk writes to this
  61.         output file the name, length, and CRC value for each file that
  62.         is listed in the input file, one file per line, as follows:
  63.  
  64.                 length  CRC  filename
  65.  
  66.         If the CRC in the input text file is a 32-bit CRC, then the CRC
  67.         in the output file will also be a 32-bit CRC.  If the CRC in the
  68.         input text file is a 16-bit CRC, then the CRC in the output text
  69.         file will be a 16-bit CRC.
  70.  
  71.         Note:  If an output file is specified but a file listed in the
  72.         input file has no CRC, then crcchk checks the -l (letter el)
  73.         flag.  If -l is specified in this case, crcchk generates a
  74.         32-bit (long) CRC for the file.  Otherwise, it defaults to
  75.         generating a 16-bit CRC for the file.
  76.  
  77. ========================================================================
  78. Example
  79. ========================================================================
  80.  
  81. The 'ls \u\brian\bin\*.exe >files.txt' command was run to produce a list
  82. of files that I wanted to check with crcchk.  You should normally
  83. specify the full pathname to the ls command so that you can later run
  84. crcchk from any directory -- crcchk will attempt to open each file using
  85. the name as listed.  I added the comment and blank line to the beginning
  86. of the file, as follows:
  87.  
  88.         # files.txt - 05/20/91 - List of files for crcchk.exe
  89.  
  90.         \u\brian\bin\ati.exe
  91.         \u\brian\bin\b.exe
  92.         \u\brian\bin\cdcl.exe
  93.         \u\brian\bin\config.exe
  94.         \u\brian\bin\ccmt.exe
  95.         \u\brian\bin\cdir.exe
  96.         \u\brian\bin\chmod.exe
  97.  
  98. The 'crcchk files.txt files.crc' command produced the following file
  99. named 'files.crc':
  100.  
  101.          7070  0xF359  \u\brian\bin\ati.exe
  102.         10000  0x8CFB  \u\brian\bin\b.exe
  103.         27630  0x13AC  \u\brian\bin\cdcl.exe
  104.         57954  0x5D88  \u\brian\bin\config.exe
  105.         14401  0x7352  \u\brian\bin\ccmt.exe
  106.         17827  0xDE07  \u\brian\bin\cdir.exe
  107.         24053  0xFE94  \u\brian\bin\chmod.exe
  108.  
  109. Now, we can run the 'crcchk files.crc' command any time we want to see
  110. if any of those executable files has been changed!  We might want to
  111. backup the 'files.crc' file or make it read-only so we don't lose the
  112. information it contains.
  113.  
  114. Note that since the length and CRC values are missing from the input
  115. text file, crcchk calculates 16-bit CRCs for the output file by default.
  116.