1#!/bin/sh 2# 3# 4 5datarootdir=@datarootdir@ 6DIR=@datadir@/ss 7AWK=@AWK@ 8SED=@SED@ 9 10for as_var in \ 11 LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ 12 LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ 13 LC_TELEPHONE LC_TIME 14do 15 if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then 16 eval $as_var=C; export $as_var 17 else 18 $as_unset $as_var 19 fi 20done 21 22if test "x$1" = x ; then 23 echo "Usage: mk_cmds file" 24 exit 1 25fi 26 27if test -n "$_SS_DIR_OVERRIDE" ; then 28 DIR="$_SS_DIR_OVERRIDE"; 29fi 30 31if test ! -f $DIR/ct_c.sed || test ! -f $DIR/ct_c.awk ; then 32 echo "mk_cmds: Couldn't find mk_cmds's template files." 33 exit 1 34fi 35 36FILE="$1" 37ROOT=`echo $1 | sed -e s/.ct$//` 38BASE=`basename "$ROOT"` 39TMP="ct$$.c" 40 41if test ! -f "$FILE" ; then 42 echo "mk_cmds: $FILE: File not found" 43 exit 1; 44fi 45 46${SED} -f "${DIR}/ct_c.sed" "${FILE}" \ 47 | ${AWK} -f "${DIR}/ct_c.awk" "rootname=${ROOT}" "outfile=${TMP}" - 48 49if grep "^#__ERROR_IN_FILE" "${TMP}" > /dev/null; then 50 rm "${TMP}" 51 exit 1 52else 53 rm -f "${BASE}.c" 54 mv -f "${TMP}" "${BASE}.c" 55 chmod a-w "${BASE}.c" 56 exit 0 57fi 58