Subversion Repositories DevTools

Rev

Rev 343 | Rev 347 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 343 Rev 345
Line 155... Line 155...
155
            unless ( $::GBE_BIN );
155
            unless ( $::GBE_BIN );
156
 
156
 
157
        #
157
        #
158
        #   Reform command
158
        #   Reform command
159
        #   With -c shell takes one argumemnt - not an array of args
159
        #   With -c shell takes one argumemnt - not an array of args
160
        #   Esacpe the users command and enclose in quotes
160
        #   Escape the users command and enclose in quotes
161
        #
161
        #
162
        @cmd = ( "$::GBE_BIN/sh", "-c", EsacpeCommand(@cmd) );
162
        @cmd = ( "$::GBE_BIN/sh", "-c", EscapeCommand(@cmd) );
163
    }
163
    }
164
 
164
 
165
    #
165
    #
166
    #   Display the command
166
    #   Display the command
167
    #
167
    #
Line 396... Line 396...
396
    #
396
    #
397
    return (wantarray) ? @cmd : join (' ', @cmd);
397
    return (wantarray) ? @cmd : join (' ', @cmd);
398
}
398
}
399
 
399
 
400
#-------------------------------------------------------------------------------
400
#-------------------------------------------------------------------------------
401
# Function        : EsacpeCommand
401
# Function        : EscapeCommand
402
#
402
#
403
# Description     : Esacpe input commands
403
# Description     : Escape input commands
404
#                   Must handle:
404
#                   Must handle:
405
#                       Embedded "
405
#                       Embedded "
-
 
406
#                       Embeded spaces
406
#                   Doesn't (yet) handle embedded \
407
#                   Doesn't (yet) handle embedded \
407
#
408
#
408
# Inputs          : Array of elements to process
409
# Inputs          : Array of elements to process
409
#
410
#
410
# Returns         : Return an escaped string
411
# Returns         : Return an escaped string
411
#
412
#
412
sub EsacpeCommand
413
sub EscapeCommand
413
{
414
{
414
    my @cmd;
415
    my @cmd;
415
 
416
 
416
    foreach ( @_ )
417
    foreach ( @_ )
417
    {
418
    {
418
        my $data = $_;
419
        my $data = $_;
419
        next unless ( $data );
420
        next unless ( $data );
420
        $data =~ s~"~\\"~g;
421
        $data =~ s~"~\\"~g;
-
 
422
        $data =~ s~ ~\\ ~g;
421
        push @cmd, $data;
423
        push @cmd, $data;
422
    }
424
    }
423
    return join (' ', @cmd);
425
    return join (' ', @cmd);
424
}
426
}
425
 
427