Annotation of coherent/e/bin/ckermit/ckustr.sed, revision 1.1

1.1     ! root        1: #! /bin/sh
        !             2: # Special cc preprocessor for using mkstr(1) to extract strings from the
        !             3: # kermit5 source.  Change the "CC=cc" line to "CC=./ckustr.sed" to use
        !             4: # string extraction.  NOTE: the file ckustr.c might need the StringFile
        !             5: # declaration modified to suit local system requirements.  When installing
        !             6: # the kermit executable be sure to install kermit.sr and make it readable
        !             7: # by the public (mode 444).
        !             8: 
        !             9: STRINGS=kermit5.sr
        !            10: 
        !            11: # Get filename and arguments.
        !            12: initargs=$@
        !            13: while [ -n "$1" ]
        !            14: do
        !            15:        if [ $1 = -o ]
        !            16:        then
        !            17:                exec cc $initargs
        !            18:                exit 1
        !            19:        fi
        !            20:        if [ `expr substr $1 1 1` = - ]
        !            21:        then
        !            22:                if [ $1 != -c ]
        !            23:                then
        !            24:                        args="$args $1"
        !            25:                fi
        !            26:        else
        !            27:                csrc=$1
        !            28:        fi
        !            29:        shift
        !            30: done
        !            31: 
        !            32: # Only process compilations, and then only for certain files.
        !            33: if [ $csrc = ckustr.c -o $csrc = ckwart.c ]
        !            34: then
        !            35:        exec cc $initargs
        !            36:        exit 1
        !            37: fi
        !            38: 
        !            39: # String extractions
        !            40: echo Extracting strings from ${csrc}...
        !            41: cc -E $args $csrc > xxmk.c
        !            42: sed -e 's/ferror(/strferrorf(/'                                \
        !            43:     -e 's/perror("/strperror("/'                       \
        !            44:     -e 's/experror(/strexperrorf(/'                    \
        !            45:     -e 's/sprintf(\([^,][^,]*\),[ ]*\("[^"]*"\)\([,)]\)/strsrerror(\2, \1\3/' \
        !            46:     -e 's/fprintf(\([^,][^,]*\),[ ]*\("[^"]*"\)\([,)]\)/strfrerror(\2, \1\3/' \
        !            47:     -e 's/printf("/strprerror("/'                              \
        !            48:        xxmk.c > mk.c
        !            49: mkstr - $STRINGS xx mk.c
        !            50: sed -e 's/^# \([0-9]\)/#line \1/' xxmk.c | xstr -c -
        !            51: echo Compiling...
        !            52: cc -Dstrferrorf=ferror -Dstrexperrorf=experror $args -c x.c
        !            53: mv x.o `basename $csrc .c`.o
        !            54: rm -f x.c mk.c xxmk.c

unix.superglobalmegacorp.com

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