home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / utlos2.zip / Doc / CRCCHK.DOC < prev    next >
Text File  |  1997-10-24  |  5KB  |  120 lines

  1. $Id: CRCCHK.DOC 1.3 1997/10/25 02:09:12 brian Exp $
  2.  
  3.                    crcchk.doc : The 'crcchk' command
  4.                           By:  Brian E. Yoder.
  5.                                 10/24/97
  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.         The filename must be enclosed in double quotes if it contains
  57.         spaces, semicolons, commas, or other punctuation. Double quotes
  58.         around the filename are optional otherwise.
  59.  
  60. ========================================================================
  61. Format of the output text file:
  62. ========================================================================
  63.  
  64.         If an output file is specified, then crcchk writes to this
  65.         output file the name, length, and CRC value for each file that
  66.         is listed in the input file, one file per line, as follows:
  67.  
  68.                 length  CRC  "filename"
  69.  
  70.         If the CRC in the input text file is a 32-bit CRC, then the CRC
  71.         in the output file will also be a 32-bit CRC. If the CRC in the
  72.         input text file is a 16-bit CRC, then the CRC in the output text
  73.         file will be a 16-bit CRC.
  74.  
  75.         Note: If an output file is specified but a file listed in the
  76.         input file has no CRC, then crcchk checks the -l (letter el)
  77.         flag. If -l is specified in this case, crcchk generates a 32-bit
  78.         (long) CRC for the file. Otherwise, it defaults to generating a
  79.         16-bit CRC for the file.
  80.  
  81. ========================================================================
  82. Example
  83. ========================================================================
  84.  
  85. The 'ls \u\brian\bin\*.exe >files.txt' command was run to produce a list
  86. of files that I wanted to check with crcchk. You should normally specify
  87. the full pathname to the ls command so that you can later run crcchk
  88. from any directory -- crcchk will attempt to open each file using the
  89. name as listed. I added the comment and blank line to the beginning of
  90. the file, as follows:
  91.  
  92.         # files.txt - 05/20/91 - List of files for crcchk.exe
  93.  
  94.         \u\brian\bin\ati.exe
  95.         \u\brian\bin\b.exe
  96.         \u\brian\bin\cdcl.exe
  97.         \u\brian\bin\config.exe
  98.         \u\brian\bin\ccmt.exe
  99.         \u\brian\bin\cdir.exe
  100.         \u\brian\bin\chmod.exe
  101.  
  102. The 'crcchk files.txt files.crc' command produced the following file
  103. named 'files.crc':
  104.  
  105.          7070  0xF359  "\u\brian\bin\ati.exe"
  106.         10000  0x8CFB  "\u\brian\bin\b.exe"
  107.         27630  0x13AC  "\u\brian\bin\cdcl.exe"
  108.         57954  0x5D88  "\u\brian\bin\config.exe"
  109.         14401  0x7352  "\u\brian\bin\ccmt.exe"
  110.         17827  0xDE07  "\u\brian\bin\cdir.exe"
  111.         24053  0xFE94  "\u\brian\bin\chmod.exe"
  112.  
  113. Now, we can run the 'crcchk files.crc' command any time we want to see
  114. if any of those executable files has been changed! We might want to
  115. backup the 'files.crc' file or make it read-only so we don't lose the
  116. information it contains.
  117.  
  118. Note that since the length and CRC values are missing from the input
  119. text file, crcchk calculates 16-bit CRCs for the output file by default.
  120.