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