X-Git-Url: http://nitlanguage.org diff --git a/src/nc b/src/nc index 2b529f7..8a382c0 100755 --- a/src/nc +++ b/src/nc @@ -16,24 +16,36 @@ # limitations under the License. NITC="../c_src/nitc" -NITCOPTS= #"-I parser -I metamodel -I syntax -I compiling -I tmp" +NITCOPTS="-v -W" +CSRC=$` (cd ../c_src; pwd) ` + +trap_action() { + test -n "$sub_command" && kill $sub_command + test -e "$pipe" && rm -f $pipe + exit 1 +} name=`basename $0` case $name in - nc) opts="";; + nc) opts="--clibdir ../c_src/clib";; nc2) opts="-p 2"; NITC="./nitc";; nc3) opts="-p 3"; NITC="./nitc_2";; nc4) opts="-p 4"; NITC="./nitc_3";; + nc5) opts="-p 5"; NITC="./nitc_4";; *) echo "unknown mode $name"; exit 1;; esac ./git-gen-version.sh "$name" +trap trap_action INT TERM echo ${NITC} ${NITCOPTS} ${opts} "$@" -k=$(mktemp nc.stderr.XXXXX) -rm "$k" -trap "rm -f $k; exit 1" INT TERM -mkfifo "$k" -${NITC} ${NITCOPTS} ${opts} "$@" 2>"$k" & -./showerr.sh <"$k" -rm "$k" +pipe=$`mktemp nc.stderr.XXXXX` +rm "$pipe" 2>/dev/null +mkfifo "$pipe" +./showerr.sh <"$pipe" & +sub_command=$! +${NITC} ${NITCOPTS} ${opts} "$@" 2>"$pipe" +err=$? +rm "$pipe" +wait +exit $err