Path: utzoo!dciem!nrcaer!scs!spl1!laidbak!att!pacbell!ames!pasteur!ucbvax!hplabs!hpda!hpsemc!bd From: bd@hpsemc.HP.COM (bob desinger) Newsgroups: comp.sources.d Subject: Re: Re: Improving SHAR Message-ID: <1110003@hpsemc.HP.COM> Date: 4 Jun 88 00:20:08 GMT Article-I.D.: hpsemc.1110003 References: <2349@bgsuvax.UUCP> Organization: HP Technology Access Center, Cupertino, CA Lines: 49 William C. DenBesten (denbeste@bgsuvax.UUCP) writes: > The solution ... > is that we need a shar-archiver that includes a crc check in it, > rather than a simple character count. > There is not a standard unix utility that will do a crc. How about the `sum' program? The System V and Xenix versions offer a -r option to produce BSD-compatible output, so you can be reasonably portable (about 95%) with that. The shar I use emits code to handle this, although I admit it has its own sum code to compute the checksums. (If I had written that part of the code, I probably would have forked the sum program instead of handcrafting the information myself. But the code was written already and it worked, so I left it in.) The emitted shar looks like this. Comments added for this article appear after the "#". # Decide if we should use `sum -r' or just plain old `sum' if sum -r /dev/null 2>&1 then sumopt='-r' else sumopt='' fi # The wrapped file goes here. # I sharred an empty file, so the numbers are 0 in this demo. # Now check the checksum. set `sum $sumopt