diff --git a/kdesrc-build b/kdesrc-build index 31a3e61..95c54df 100755 --- a/kdesrc-build +++ b/kdesrc-build @@ -4342,14 +4342,19 @@ sub clone_options } } -# Subroutine to process the command line arguments. Any arguments so -# processed will be removed from @ARGV. -# The arguments are generally documented in doc.html now. +# Subroutine to process the command line arguments, which should be passed as +# a list. The list of module names passed on the command line will be returned, +# other options are generally entered into the 'global' option set. +# NOTE: One exception to the return value is that if --run is passed, the list +# of options to pass to the new program is returned instead (you can tell by +# evaluating the '#start-program' option. # NOTE: Don't call finish() from this routine, the lock hasn't been obtained. # NOTE: The options have not been loaded yet either. Any option which # requires more than rudimentary processing should set a flag for later work. sub process_arguments { + my @savedOptions = @_; # Used for --debug + my @options = @_; my $arg; my $version = "kdesrc-build $versionNum"; my $author = <new($_) } (@ARGV); + return map { Module->new($_) } (@enteredModules); } # Installs the given subroutine as a signal handler for a set of signals which @@ -7332,9 +7333,12 @@ EOF # difference is that the environment variables should be as set in kdesrc-build # instead of as read from .bashrc and friends. # -# Meant to implement the --shell command line option. -sub execute_command_line_program() +# You should pass in the options to run the program with as a list. +# +# Meant to implement the --run command line option. +sub execute_command_line_program { + my @args = @_; my $program = get_option('global', '#start-program'); if (not $program) @@ -7349,11 +7353,11 @@ sub execute_command_line_program() exit 1; } - debug "Executing b[r[$program] ", join(' ', @ARGV); + debug "Executing b[r[$program] ", join(' ', @args); exit 0 if pretending; - exec $program, @ARGV or do { + exec $program, @args or do { # If we get to here, that sucks, but don't continue. error "Error executing $program: $!"; exit 1; @@ -7633,7 +7637,7 @@ eval # Note: Don't change the order around unless you're sure of what you're # doing. set_debug_colors(); # Default to colorized output if sending to TTY - my @modules = process_arguments(); # Process --help, --install, etc. first. + my @modules = process_arguments(@ARGV); # Process --help, --install, etc. first. # Change name and type of command line entries beginning with + to force # them to be XML project modules. @@ -7654,7 +7658,8 @@ eval if (get_option('global', '#start-program')) { - execute_command_line_program(); + # @modules is the command line arguments to pass in this case. + execute_command_line_program(@modules); } if (get_option('global', 'kde-languages'))