home *** CD-ROM | disk | FTP | other *** search
- $Id: CRCCHK.DOC 1.2 1997/06/02 00:25:45 brian Exp $
-
- crcchk.doc : The 'crcchk' command
- By: Brian E. Yoder.
- 06/16/92
-
- (c) Copyright International Business Machines Corporation 1997
- All rights reserved.
-
- The crcchk command is used to record the length and CRC value (either
- 16-bit or 32-bit) for a list of files. It can then be used at a later
- time to check and see which, if any, of the files has been changed.
-
- ========================================================================
- Command syntax
- ========================================================================
-
- crcchk [ -l ] infile [ outfile ]
-
- The program reads the input text file and calcuates the length and CRC
- of each file listed. If the input file also contains a length and CRC
- value for a file, then those values are compared against the calculated
- values for that file. This input file can be created by redirecting the
- output of the crc command into it (see crc.doc for more information).
-
- If an output file name is specified, then each file listed in the input
- text file, along with its actual length and CRC, is written to the
- output file. Later, this output file can be read by the crcchk program
- to check to see if any of the listed files has changed.
-
- The -l (letter el) flag is only used if an output file is specified.
-
- ========================================================================
- Format of the input text file:
- ========================================================================
-
- Blank lines are ignored. Lines that begin with # are assumed to
- contain comments and are ignored. Each non-blank, non-comment
- line must be formatted as follows:
-
- [ length CRC ] filename
-
- The length and CRC values are optional. Either both must be
- present or both must be missing. If present, the length must be
- specified in decimal, while the CRC must be specified in hex as
- 0x followed by one or more hexadecimal digits.
-
- If the CRC is 0xNNNN or shorter (4 or less hex digits), then it
- is assumed to be a 16-bit CRC. If it contains 5 or more hex
- digits, then it is assumed to be a 32-bit CRC.
-
- If the length and CRC value are present, then crcchk compares
- the values to those it calculated and logs discrepancies to
- stderr.
-
- ========================================================================
- Format of the output text file:
- ========================================================================
-
- If an output file is specified, then crcchk writes to this
- output file the name, length, and CRC value for each file that
- is listed in the input file, one file per line, as follows:
-
- length CRC filename
-
- If the CRC in the input text file is a 32-bit CRC, then the CRC
- in the output file will also be a 32-bit CRC. If the CRC in the
- input text file is a 16-bit CRC, then the CRC in the output text
- file will be a 16-bit CRC.
-
- Note: If an output file is specified but a file listed in the
- input file has no CRC, then crcchk checks the -l (letter el)
- flag. If -l is specified in this case, crcchk generates a
- 32-bit (long) CRC for the file. Otherwise, it defaults to
- generating a 16-bit CRC for the file.
-
- ========================================================================
- Example
- ========================================================================
-
- The 'ls \u\brian\bin\*.exe >files.txt' command was run to produce a list
- of files that I wanted to check with crcchk. You should normally
- specify the full pathname to the ls command so that you can later run
- crcchk from any directory -- crcchk will attempt to open each file using
- the name as listed. I added the comment and blank line to the beginning
- of the file, as follows:
-
- # files.txt - 05/20/91 - List of files for crcchk.exe
-
- \u\brian\bin\ati.exe
- \u\brian\bin\b.exe
- \u\brian\bin\cdcl.exe
- \u\brian\bin\config.exe
- \u\brian\bin\ccmt.exe
- \u\brian\bin\cdir.exe
- \u\brian\bin\chmod.exe
-
- The 'crcchk files.txt files.crc' command produced the following file
- named 'files.crc':
-
- 7070 0xF359 \u\brian\bin\ati.exe
- 10000 0x8CFB \u\brian\bin\b.exe
- 27630 0x13AC \u\brian\bin\cdcl.exe
- 57954 0x5D88 \u\brian\bin\config.exe
- 14401 0x7352 \u\brian\bin\ccmt.exe
- 17827 0xDE07 \u\brian\bin\cdir.exe
- 24053 0xFE94 \u\brian\bin\chmod.exe
-
- Now, we can run the 'crcchk files.crc' command any time we want to see
- if any of those executable files has been changed! We might want to
- backup the 'files.crc' file or make it read-only so we don't lose the
- information it contains.
-
- Note that since the length and CRC values are missing from the input
- text file, crcchk calculates 16-bit CRCs for the output file by default.
-