#!/bin/csh -f # -*- mode: c -*- -- # ************************************************************************ # Copyright (C) 1988 Microelectronics and Computer Technology Corporation # - VLSI CAD Program - %Y% # ************************************************************************ # File: %P%, $VHDL_TEST/Analyzer/VHD/make-shar-files # Title: UNIX csh script to create packed 'shar' files. # Author: Steve Grout # Version: %W% - last modified %E% # sccsid: %W% %G% # ********************************************************************** # Description: # This script will go thru a Chapter directory and create multi-part # shar files with both VHDL-SW repository and howto header # in order to make them ready to send out. Max shar file # size is =< 50000 bytes with 10percent provided for shar creation overhead. # Online help is available executing the script without any arguments. # You are assumed to already be cd'd to just above the # chapter dirs of interest. --jsgrout 5/5/88 # # Modification History: # -------------------------------------------------------------------- # draft begin by jsgrout 8/19/88. # debug complete (sure, sure,...) --jsgrout 8/23/88 # ********************************************************************** #----------------------------------------------------- # set verbose set suffix = "vhdl" @ maxsharsize = 50000 - 5000 if ($#argv <= 1 ) then echo " Usage: make-shar-files file-suffix directory { max-shar-size }" echo " where" echo " file-suffix = suffix of all files to be included." echo " directory = name of directory area containing the files." echo " max-shar-size = Maximum size that the shar file may become." echo " Multiple shar files will be created until" echo " all selected files have been included." echo " (Note - max-shar-size is 50000 bytes by default.)" echo "" exit endif set suffix = $1 set dirarea = $2 set VHD = ( .. ) if ( $3 != "" ) then # get the user's max-shar-size and trim down for shar bytes by 10 percent @ maxsharsize = $2 * 0.9 endif if ( $dirarea == "" ) then set dirarea = ( . ) endif # foreach dirnum ( 01 02 03 04 05 06 07 08 09 10 11 12 13 14 ) # foreach dirnum ( 01 02 03 04 05 06 07 08 09 13 14 ) # move down into the chapter area for convenience... cd $dirarea # start a new part-1 shar @ partnum = 1 @ sharsiz = 0 # set up a begining shar file with # 1. a vhdl-sw repository header # 2. an mcc shared test information header cat $VHD/Header-vhdl-sw-repository.pro > $dirarea-test-$suffix-part-$partnum.shar echo This is part $partnum of chapter $dirarea >> $dirarea-test-$suffix-part-$partnum.shar cat $VHD/Header-testfile-shar.pro >> $dirarea-test-$suffix-part-$partnum.shar echo "....................................." echo " Starting to build the test shar file, $dirarea-test-$suffix-part-$partnum.shar..." # start counting bytes in the shar file being built: set filesize = `wc -c $dirarea-test-$suffix-part-$partnum.shar` @ sharsiz = $sharsiz + $filesize[1] echo "initial shar file size = $sharsiz" # BEGIN GOING THRU ALL FILES... foreach fil ( *.$suffix ) set filesize = `wc -c $fil` @ testsize = $filesize[1] @ sizeleft = $maxsharsize - $sharsiz - $testsize if ( $sizeleft > 0 ) then # WE HAVE ROOM SO ADD IT IN... shar $fil >> $dirarea-test-$suffix-part-$partnum.shar set filesize = `wc -c $dirarea-test-$suffix-part-$partnum.shar` @ sharsiz = $filesize[1] echo " added $fil with current shar file size of $sharsiz bytes." # echo " (current shar file size = `wc -c $dirarea-test-$suffix-part-$partnum.shar` )" else # WE NEED TO START A NEW SHAR FILE... @ partnum = $partnum + 1 @ sharsiz = 0 cat $VHD/Header-vhdl-sw-repository.pro > $dirarea-test-$suffix-part-$partnum.shar echo This is part $partnum of chapter $dirarea >> $dirarea-test-$suffix-part-$partnum.shar cat $VHD/Header-testfile-shar.pro >> $dirarea-test-$suffix-part-$partnum.shar echo "....................................." echo " Starting to build the test shar file, $dirarea-test-$suffix-part-$partnum.shar..." # start counting bytes in the shar file being built: set filesize = `wc -c $dirarea-test-$suffix-part-$partnum.shar` @ sharsiz = $filesize[1] # and add in this test file... shar $fil >> $dirarea-test-$suffix-part-$partnum.shar set filesize = `wc -c $dirarea-test-$suffix-part-$partnum.shar` @ sharsiz = $filesize[1] echo " added $fil with current shar file size of $sharsiz bytes." # echo " (current shar file size = `wc -c $dirarea-test-$suffix-part-$partnum.shar` )" endif # END FOREACH $fil LOOP end echo " ----------------------------------------" echo "all done building shar files in directory = $dirarea ..." echo "final test shar file sizes were..." ls -l $dirarea-test-$suffix-part-*.shar echo " ----------------------------------------" # move back up to VHD area.. cd .. # end foreach $dirnum loop # end