scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

0027-extract.sh (760B)


      1 #!/bin/sh
      2 
      3 set -e
      4 
      5 cleanup()
      6 {
      7 	st=$?
      8 	rm -f file* $tmp1 $tmp2
      9 	exit $st
     10 }
     11 
     12 trap 'rm -f file* $tmp1' EXIT
     13 trap 'exit 1' HUP INT TERM
     14 
     15 tmp1=tmp1.$$
     16 
     17 ############################################################################
     18 #extract without parameters
     19 
     20 cp master.a file.a
     21 $EXEC scc ar -xv file.a
     22 
     23 cat file1 file2 file3 > $tmp1
     24 diff -u $tmp1 - <<EOF
     25 This is the first file,
     26 and it should go in the
     27 first position in the archive.
     28 But this other one is the second one,
     29 and it shouldn't go in the first position
     30 because it should go in the second position.
     31 and at the end, this is the last file
     32 that should go at the end of the file,
     33 thus it should go in the third position.
     34 EOF
     35 
     36 if test `ls file? | wc -l` -ne 3
     37 then
     38 	echo some error extracting files
     39 	exit 1
     40 fi