Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/17/84; site gatech.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxj!ihnp4!zehntel!hplabs!hpda!fortune!amd!decwrl!decvax!mcnc!akgua!gatech!spaf
From: spaf@gatech.UUCP (Gene Spafford)
Newsgroups: net.sources
Subject: Re: Preparing Files for Extraction
Message-ID: <10292@gatech.UUCP>
Date: Wed, 19-Sep-84 09:46:02 EDT
Article-I.D.: gatech.10292
Posted: Wed Sep 19 09:46:02 1984
Date-Received: Wed, 26-Sep-84 19:32:52 EDT
References: <1755@uw-june>, <309@ncoast.UUCP> <10173@gatech.UUCP>
Organization: The Clouds Project, School of ICS, Georgia Tech
Lines: 57

Submission #2.
After my first posting I received a number of suggestions for changes
and enhancements.  Thanks to jpl@allegra, and most especially to
Corey Satten (corey@fluke), I now submit the following for
your consideration and use.

This runs under "csh" but produces shar archives which are
unbundled with "sh".


#! /bin/csh 
# bundle:  group files into distribution package in "shar" format
#          suitable for extraction with sh, not csh.
#

set command = $0
set errors = 0

if (! ${#argv}) then
	echo "usage: $command:t file1 file2 file3 ... fileN > file.shar"
	exit 1
	endif

echo ': to unbundle, "sh" this file -- DO NOT use csh'
echo ':  SHAR archive format.  Archive created '`date`

foreach file ($argv)
	if (! (-r $file && -f $file) ) then
		echo $command:t": cannot archive '$file'" > /dev/tty
		@ errors++
		continue
		endif
	echo "echo x - $file:t"
	echo "sed 's/^X//' > $file:t <<'+FUNKY+STUFF+'"
	sed 's/^/X/' $file
	echo "+FUNKY+STUFF+"
	if (-d $file:h) then
		echo "echo '`(cd $file:h; ls -l $file:t)`    (as sent)'"
	else
		echo "echo '`ls -l $file:t`    (as sent)'"
		endif
	ls -l $file | sed \
		-e 's/^.\(...\)\(...\)\(...\).*/u=\1,g=\2,o=\3/' \
		-e 's/-//g' \
		-e 's/.*/chmod & '"$file:t/"
	echo "ls -l $file:t"
	end
echo "exit 0"

exit $errors
-- 
Off the Wall of Gene Spafford
The Clouds Project, School of ICS, Georgia Tech, Atlanta GA 30332
Phone:	(404) 894-6169, (404) 894-6170 [messages]
CSNet:	Spaf @ GATech		ARPA:	Spaf%GATech.CSNet @ CSNet-Relay.ARPA
uucp:	...!{akgua,allegra,amd,hplabs,ihnp4,masscomp,ut-ngp}!gatech!spaf
	...!{rlgvax,sb1,seismo,uf-cgrl,unmvax,ut-sally}!gatech!spaf