scc

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

0001-append.sh (496B)


      1 #!/bin/sh
      2 
      3 set -e
      4 
      5 tmp1=`mktemp`
      6 tmp2=`mktemp`
      7 
      8 trap "rm -f file.a f1 f2 f3 $tmp1 $tmp2; exit" 0 2 3
      9 
     10 ###########################################################################
     11 #Append generated files at once to an empty archive
     12 
     13 echo First > file1
     14 echo Second > file2
     15 echo Third > file3
     16 
     17 rm -f file.a
     18 ar -qv file.a file1 file2 file3
     19 
     20 ar -t file.a > $tmp1
     21 
     22 cat <<EOF > $tmp2
     23 file1
     24 file2
     25 file3
     26 EOF
     27 
     28 cmp $tmp1 $tmp2
     29 
     30 ar -p file.a > $tmp1
     31 
     32 cat <<EOF > $tmp2
     33 First
     34 Second
     35 Third
     36 EOF
     37 
     38 cmp $tmp1 $tmp2