Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!cmcl2!husc6!bbn!bbn.com!rsalz From: rsalz@bbn.com (Rich Salz) Newsgroups: comp.sources.d Subject: Re: You can help improve shar Message-ID: <1056@fig.bbn.com> Date: 13 Sep 88 16:15:56 GMT References: <1823@erix.ericsson.se> <574@pcrat.UUCP> Organization: BBN Systems and Technologies, Inc. Lines: 72 =In <1823@erix.ericsson.se> howard@erix.ericsson.se (Howard Gayle) writes: =I am working on yet another version of shar, called trshar =because it uses the tr command when necessary. Trshar will =archive any files containing any bytes, using tr if necessary =to encode unprintable characters in printable form. In <574@pcrat.UUCP> rick@pcrat.UUCP (Rick Richardson) writes: =I took Rich $alz's 'cshar' package a while back and modified it =to compress and then uuencode binary files. ... =... I would suggest, however, that anything =you do be based upon Rich's package. Thanks for the compliment, Rick. Lemme just throw out a few words on shars. As comp.sources.unix moderator I've seen many different types, and with the release of my cshar package I seem to have had a great influence on what the world uses. There seem to be three major shar philosophies: 1. Use a generator that's dumb and simple and elegant. Can't get any easier than this little fellow from Kernighan and Pike, "bundle": #! /bin/sh echo '#To unpack, delete all lines before this and feed to /bin/sh' for I do echo "echo $I 1>&2" echo "cat >$I <<'END'" cat <$I echo "END" done Easy to use: "bundle *.[ch] | mail user@site.domain" 2. Write a generator that will split large files, wrap long lines, convert binary to ASCII for transmission, walk directories, etc. Kind of easy to use: mondoshar -n '/tmp/files' /unix /etc/termcap for I in /tmp/files* ; do mail user@site.domain <$I ; rm $I done 3. Write a generator that is fairly robust about shipping text files around in today's networks. Method #1 is cool -- ultimate Unix philosophy. It's also guaranteed to generate files that are too big to mail around, or will otherwise cause problems for some sites (lines with just a period in them, for example). Method #2 is big and bulky. Often easy to use, except when you run across the one thing it can't handle ("whaddya mean it doesn't followed the symlink?"). The resultant shars are often useless on non-Unix systems, and can be subject to dialect differences even there. Method #3 seems like a reasonable compromise. Not surprisingly, it's the one I took. It works real well at getting SOURCES from here to there. It includes multi-part checks, is fairly easy to parse, and does some limited error-checking. Coupled with a "shar parser", this method gives you something that works on a wide variety of systems -- MSDOS, VMS, Unix. If you want to send binary or really big files, you have to special-case it and do some work by hand. I don't mind that, because I've yet to find a tool that really handles every one of those special cases -- and certainly nothing that works on all kinds of systems. In conclusion, if you think the world really needs another shell archive generator, give some serious thought to what problem you're trying to solve, and where it will be solved. Hope this info is useful. /rich $alz -- Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.