v02INF4: extraction shell script for hpdoc

Mike Wexler mikew at wyse.wyse.com
Thu Dec 22 05:56:54 AEST 1988


Submitted-by: mikew at wyse.com (Mike Wexler)
Posting-number: Volume 2, Info 4
Archive-name: x.sh

[The extraction script that was included in the HP widgets documentation
doesn't work.  Here is a version that should work. -mcw]
#! /bin/sh
echo extracting data...
/bin/awk '
BEGIN { inhex = 0 ; part = 0 }
/^---/ {
  if ($2 == "start") part++
  if ($6 != part) exit 1
  if (inhex && (NF > 1))
    inhex = 0
  else {
    inhex = 1
    getline
  }
}
{ if (inhex) print $0 }'  > /tmp/xtr$$

 if test $? = 1 ; then
   echo 'Parts sent through out of order!! Punting.'
   /bin/rm -f /tmp/xtr$$
   exit 1
 fi

echo ...finished extraction, starting uudecode...
fname=`head -100 /tmp/xtr$$ | grep begin | cut -f3 -d' '`
OurDir=`pwd`
cd /tmp
uudecode xtr$$
/bin/rm -f xtr$$
/bin/chmod  777 $fname
mv $fname $fname.Z
echo ...finished uudecode, starting uncompress...
uncompress $fname
cd $OurDir
echo ...finished uncompress, starting tar extraction...
tar xvf $fname
/bin/rm -f /tmp/xtr* $fname
 
-- 
Mike Wexler(wyse!mikew)    Phone: (408)433-1000 x1330
Moderator of comp.sources.x



More information about the Comp.sources.x mailing list