r9260: only overwrite destination files when the temp files was created correct
authorStefan Metzmacher <metze@samba.org>
Fri, 12 Aug 2005 09:51:40 +0000 (09:51 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:33:20 +0000 (13:33 -0500)
metze
(This used to be commit b5626c978fe3349f0972e1aeea51b05e66c6ce33)

source4/script/lex_compile.sh
source4/script/yacc_compile.sh

index 09f8253af724621d08536ba377b58d1725ad11a5..f33a7f0fbaf0bf8e332a4eb1f5833d3cb7b27b25 100755 (executable)
@@ -18,7 +18,9 @@ if [ -r $DEST ]; then
 fi
 TOP=`pwd`
 if cd $dir && $LEX $file; then
-       sed '/^#/ s|$base.yy\.c|$DEST|' $base.yy.c > $base.c
-       rm -f $base.yy.c
+       if [ -r $base.yy.c ];then
+               sed '/^#/ s|$base.yy\.c|$DEST|' $base.yy.c > $base.c
+               rm -f $base.yy.c
+       fi
 fi
 cd $TOP
index 4c87b7c4b756696eb89339f050767782ab1a53f1..77b5efb06f88e8a269be04bee6c6b45eae35a1a8 100755 (executable)
@@ -18,8 +18,11 @@ if [ -r $DEST ]; then
 fi
 TOP=`pwd`
 if cd $dir && $YACC -d $file; then
-       sed -e "/^#/!b" -e "s|y\.tab\.h|$base.h|" y.tab.h > $base.h
-       sed '/^#/ s|y\.tab\.c|$base.c|' y.tab.c > $base.c
-       rm -f y.tab.c y.tab.h
+       if [ -r y.tab.h -a -r y.tab.c ];then
+               echo "move files"
+               sed -e "/^#/!b" -e "s|y\.tab\.h|$base.h|" y.tab.h > $base.h
+               sed '/^#/ s|y\.tab\.c|$base.c|' y.tab.c > $base.c
+               rm -f y.tab.c y.tab.h
+       fi
 fi
 cd $TOP