A self-referential challenge

Rahul Dhesi dhesi at bsu-cs.UUCP
Sun Mar 19 08:14:44 AEST 1989


I recently posted "brik", a general-purpose CRC-32 program, to
comp.binaries.ibm.pc (includes portable C source) and was amused to
consider the following problem.  The command

     brik -G * > crc.lst

generates a list of filenames and CRCs in crc.lst, which may be later checked
with 

     brik -C crc.lst

This always reports a CRC error for "crc.lst" itself, since the CRC
recorded for it was based on its contents before it was closed.  What I
would like to do is find a way of having brik generate a CRC list that
includes the corect CRC of the file containing that list.  I don't
expect to find a simple solution, but it will be fun seeing people
try.
-- 
Rahul Dhesi         UUCP:  <backbones>!{iuvax,pur-ee}!bsu-cs!dhesi
                    ARPA:  dhesi at bsu-cs.bsu.edu



More information about the Comp.lang.c mailing list