Napawiony ser - musialem przerobic z powrotem te na system w dwoch liniach.

(Wyglada na to, ze program uruchomiony w tych ` ` nie ma lacznosci z konsola)



git-svn-id: svn://atos.wmid.amu.edu.pl/utt@20 e293616e-ec6a-49c2-aa92-f4a8b91c5d16
This commit is contained in:
obrebski 2008-04-01 19:15:47 +00:00
parent 2fe08ac317
commit e2bde98bb1

View File

@ -96,6 +96,7 @@ END
exit 0;
}
die("$0: no pattern given.\n") unless $pattern;
die("$0: flex template file not found") unless
@ -154,26 +155,32 @@ my $defaultaction = ($only_matching) ? '' : 'ECHO';
(undef, my $tmpfile_c) = File::Temp::tempfile(SUFFIX=>'.c');
(undef, my $tmpfile_x) = File::Temp::tempfile();
# w tych `` nie dziala
#`m4 "--define=PATTERN=$flexpattern" "--define=DEFAULTACTION=$defaultaction" $flextemplate > $tmpfile_l`;
`m4 "--define=PATTERN=$flexpattern" "--define=DEFAULTACTION=$defaultaction" $flextemplate > $tmpfile_l`;
system "m4 \"--define=PATTERN=$flexpattern\" \"--define=DEFAULTACTION=$defaultaction\" $flextemplate > $tmpfile_l";
if($flex)
{
if(open(FLEX, $tmpfile_l)) {
while(<FLEX>) {
print @_;
}
close FLEX;
}
else {
print "Unable to open file $tmpfile_l\n";
}
exit 0;
# w tych `` nie dziala
system "cat $tmpfile_l";
# if(open(FLEX, $tmpfile_l)) {
# while(<FLEX>) {
# print @_;
# }
# close FLEX;
# }
# else {
# print "Unable to open file $tmpfile_l\n";
# }
exit(0);
}
`flex -o$tmpfile_c $tmpfile_l`;
`cc -O3 -o $tmpfile_x $tmpfile_c -lfl`;
`$tmpfile_x`;
#`$tmpfile_x`;
system "$tmpfile_x";
unlink $tmpfile_l;
unlink $tmpfile_c;