ljz@fxgrp.UUCP (Lloyd Zusman) (12/18/87)
I am looking for a fairly complete 'shar' program written in C. It should have the following features: (1) It must be able to traverse directory trees if desired. This means that it must be able to build its shar files from files that might have to be retrieved from a directory tree, and that it must put the proper shell commands into the resulting shar files that cause the apporpriate directories to be created and filled with the appropriate files when un-shar-ing. (2) It must be able to build shar files no larger than a maximum size so I can easily mail and uucp these shar files around. Both of these features are essential, and I'm hoping I can find a shar program that has them both. We already have one that has feature #1, but although in general it isn't difficult to hack the code to have the output of shar go to a new file if the old file is bigger than a certain size, it is a painful process to do this correctly with the shar program we currenty have: it is written in such a way that it needs a respectable amount of rewriting in order to make sure the appropriate mkdir and chdir commands go at the beginning of every new shar file (otherwise files may not end up in the proper directories upon un-shar-ing). Rather than re-invent the wheel here and redo a goodly percentage of our incomplete shar program, I'm hoping that someone on the net would be so kind as to email me the C source code to an already-existing shar that has the features I want. There are a few other features that I would like to have in this shar program but are, in my opinion, luxuries I could live without if they don't exist: (A) To have the files compressed and/or uuencoded before stuffing them into the shar files. This, of course, would require the appropriate uncompress and/or uudecode commands getting placed into the resulting shar file. (B) To be able to specify what prefix goes on the beginning of each line when 'sed' is used for un-shar-ing. No prefix would mean to use 'cat' instead of 'sed'. (C) To specify, in addition to the maximum size of a shar file, the maximum size of a 'here document' to be used in the shar file. In other words, consider this fragment which could be in a constructed shar file: 1. /bin/sed 's/^X//' <<\END_OF_IT >file.name 2. X the shar-ed file 3. X ... 4. \END_OF_IT [Note: the '<<' construct is sometimes called a 'here document']. In our 'sh' program running under SunOS version 3.4, there is a maximum amount of data that can exist between lines 1 and 4 in the example above. Quite often when I try to un-shar something I get over the net, 'sh' will blow up if this 'here document' is too long. I then have to un-shar it by hand. In my ideal shar program, if a file is larger than the maximum 'here document' size specified to the shar program, it would do something like using split to break the file into smaller pieces before shar-ing and then putting code into the shar file to paste the pieces back together upon un-shar-ing. Our site does not have anything but uucp access, and hence FTP-type things are out of the question for me. Otherwise, I'd try to find this in comp.sources.misc or wherever. I'm not sure where to post this request if not here. Sorry if I am in the wrong place to make this request. Thanks in advance for your kind and generous help. ------------------------------------------------------------------------- Lloyd Zusman Master Byte Software Los Gatos, California Internet: fxgrp!ljz@ames.arpa "We take things well in hand." UUCP: ...!ames!fxgrp!ljz