- } elsif ( $line =~ /^!\s*output sort/ ) { #output sort
- if ( defined( $cmd{'cmd'} ) ) {
- exec_cmd( \%cmd );
- %cmd = ();
- }
- $cmd{'sort'} = 1;
- if ( $line =~ /^!\s*output sort\s+(\d+)/ ) {
- $sort_prefix = $1;
- }
- } elsif ( $line =~ /^!\s*output ignore/ ) { #output ignore
- if ( defined( $cmd{'cmd'} ) ) {
- exec_cmd( \%cmd );
- %cmd = ();
- }
- $cmd{'output ignore'} = 1;
- } elsif ( $line =~ /^!\s*output display/ ) { #output display
- if ( defined( $cmd{'cmd'} ) ) {
- exec_cmd( \%cmd );
- %cmd = ();
- }
- $cmd{'output display'} = 1;
- } elsif ( $line =~ /^!\s*expect signal (\w*)/ ) { #expect signal SIGABRT
- if ( defined( $cmd{'cmd'} ) ) {
- exec_cmd( \%cmd );
- %cmd = ();
- }
- $cmd{'expect'} = "$1";
- } elsif ( $line =~ /^!\s*expect return/ ) { #expect return
- if ( defined( $cmd{'cmd'} ) ) {
- exec_cmd( \%cmd );
- %cmd = ();
- }
- $line =~ s/^! expect return //g;
- $line =~ s/\r//g;
- $cmd{'return'} = $line;
- } elsif ( $line =~ /^!\s*setenv/ ) { #setenv
- if ( defined( $cmd{'cmd'} ) ) {
- exec_cmd( \%cmd );
- %cmd = ();
- }
- $line =~ s/^! setenv //g;
- $line =~ s/\r//g;
- setenv_cmd($line);
- } elsif ( $line =~ /^!\s*timeout/ ) { #timeout
- if ( defined( $cmd{'cmd'} ) ) {
- exec_cmd( \%cmd );
- %cmd = ();
- }
- $line =~ s/^! timeout //;
- $line =~ s/\r//g;
- $cmd{'timeout'} = $line;
+ # Deal with the meta-commands
+ } elsif ( $line =~ /^! (.*)/) {
+ $line = $1;
+
+ if ( $line =~ /^output sort/ ) {
+ $cmd{'sort'} = 1;
+ if ( $line =~ /^output sort\s+(\d+)/ ) {
+ $sort_prefix = $1;
+ }
+ } elsif ($line =~ /^output ignore/ ) {
+ $cmd{'output ignore'} = 1;
+ } elsif ( $line =~ /^output display/ ) {
+ $cmd{'output display'} = 1;
+ } elsif ( $line =~ /^expect signal (\w*)/ ) {
+ $cmd{'expect'} = $1;
+ } elsif ( $line =~ /^expect return/ ) {
+ $line =~ s/^expect return //g;
+ $line =~ s/\r//g;
+ $cmd{'return'} = $line;
+ } elsif ( $line =~ /^setenv/ ) {
+ $line =~ s/^setenv //g;
+ $line =~ s/\r//g;
+ setenv_cmd($line);
+ } elsif ( $line =~ /^timeout/ ) {
+ $line =~ s/^timeout //;
+ $line =~ s/\r//g;
+ $cmd{'timeout'} = $line;
+ }