Annotation of gcc/c++, revision 1.1.1.2

1.1       root        1: #!/bin/sh
                      2: # Compile programs, treating .c files as C++.
1.1.1.2 ! root        3: : || exec /bin/sh -f $0 $argv:q
1.1       root        4: 
                      5: newargs=
                      6: quote=no
                      7: library=-lg++
                      8: havefiles=
                      9: 
                     10: for arg in $*;
                     11: do
                     12:   if [ $quote = yes ]
                     13:   then
                     14:     newargs="$newargs $arg"
                     15:     quote=no
                     16:   else
                     17:     quote=no
                     18:     case $arg in
                     19:       -nostdlib)
                     20:        # Inhibit linking with -lg++.
                     21:        newargs="$newargs $arg"
                     22:        library=
                     23:        ;;
                     24:       -[bBVDUoeTuIYmLiA] | -Tdata)
                     25:        newargs="$newargs $arg"
                     26:        # these switches take following word as argument,
                     27:        # so don't treat it as a file name.
                     28:        quote=yes
                     29:        ;;
                     30:       -[cSE])
                     31:        # Don't specify libraries if we won't link,
                     32:        # since that would cause a warning.
                     33:        newargs="$newargs $arg"
                     34:        library=
                     35:        ;;
                     36:       -xnone)
                     37:        newargs="$newargs $arg"
                     38:        speclang=
                     39:        ;;
                     40:       -x*)
                     41:        newargs="$newargs $arg"
                     42:        speclang=yes
                     43:        ;;
                     44:       -*)
                     45:        # Pass other options through; they don't need -x and aren't inputs.
                     46:        newargs="$newargs $arg"
                     47:        ;;
                     48:       *)
                     49:        havefiles=yes
                     50:        # If file ends in .c or .i, put options around it.
                     51:        # But not if a specified -x option is currently active.
                     52:        temp=`expr $arg : '.*\.[ci]$'`
                     53:        if [ \( x$temp != x0 \) -a \( x$speclang = x \) ]
                     54:        then
                     55:          newargs="$newargs -xc++ $arg -xnone"
                     56:        else
                     57:          newargs="$newargs $arg"
                     58:        fi
                     59:        ;;
                     60:     esac
                     61:   fi
                     62: done
                     63: 
                     64: if [ x$havefiles = x ]
                     65: then
                     66:   echo "$0: no input files specified"
                     67:   exit 1
                     68: fi
                     69: 
                     70: progname=`echo $0 |sed -e 's|/[^/]*$|/gcc|'`
                     71: if [ -f ${progname} ]
                     72: then
                     73: exec ${progname} $newargs $library
                     74: else
                     75: exec gcc $newargs $library
                     76: fi

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.