changeset 1392:2e1e5d2d4ce7 rel-0_6_16_2

rpouch: Fix the occasional "tfclose: : bad handle" error when handling random containers.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 12 Jul 2011 11:43:16 +0300
parents bb9c5005805e
children dde48ab50313 6bce2e02518f
files gm-rpouch.tf
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/gm-rpouch.tf	Sat Jul 09 11:34:55 2011 +0300
+++ b/gm-rpouch.tf	Tue Jul 12 11:43:16 2011 +0300
@@ -26,10 +26,14 @@
 /set rpouch_get=0
 /set rpouch_regs=
 
-/def -i -F -msimple -t"It is labeled as 'pussi'." grpouch_fgrab =\
+/def -i grpouch_close =\
 	/if (rpouch_save!~"" & rpouch_save >= 0)\
 		/test tfclose(rpouch_save)%;\
-	/endif%;\
+		/set rpouch_save=-1%;\
+	/endif
+
+/def -i -F -msimple -t"It is labeled as 'pussi'." grpouch_fgrab =\
+	/grpouch_close%;\
 	/set rpouch_save=$[tfopen(strcat(HOME,"/public_html/reagents.txt"),"w")]
 
 /def -i grpouch_report =\
@@ -78,10 +82,7 @@
 	/msq @{BCred}No such reagent pouch@{n} '@{BCgreen}%{rpouch_target}@{n}'!
 
 /def -i -p999 -F -mregexp -t"^This item is in " grpouch_end =\
-	/if (rpouch_save >= 0)\
-		/test tfclose(rpouch_save)%;\
-		/set rpouch_save=-1%;\
-	/endif%;\
+	/grpouch_close%;\
 	/if (rpouch_st & !rpouch_get)\
 		/let _nval=$[rpouch_total_pwr + rpouch_total_std + rpouch_total_por]%;\
 		/if (opt_reglite=~"on")\