@@ -45,7 +45,7 @@ impl ValidUsage {
4545
4646enum Action {
4747 Call ( extern "Rust" fn ( args : & [ ~str ] ) -> ValidUsage ) ,
48- CallMain ( & ' static str , extern "Rust" fn ( ) ) ,
48+ CallMain ( & ' static str , extern "Rust" fn ( & [ ~ str ] ) ) ,
4949}
5050
5151enum UsageSource < ' self > {
@@ -69,7 +69,7 @@ static NUM_OF_COMMANDS: uint = 7;
6969static COMMANDS : [ Command < ' static > , .. NUM_OF_COMMANDS ] = [
7070 Command {
7171 cmd : "build" ,
72- action : CallMain ( "rustc" , rustc:: main ) ,
72+ action : CallMain ( "rustc" , rustc:: main_args ) ,
7373 usage_line : "compile rust source files" ,
7474 usage_full : UsgCall ( rustc_help) ,
7575 } ,
@@ -95,19 +95,19 @@ static COMMANDS: [Command<'static>, .. NUM_OF_COMMANDS] = [
9595 } ,
9696 Command {
9797 cmd : "doc" ,
98- action : CallMain ( "rustdoc" , rustdoc:: main ) ,
98+ action : CallMain ( "rustdoc" , rustdoc:: main_args ) ,
9999 usage_line : "generate documentation from doc comments" ,
100100 usage_full : UsgCall ( rustdoc:: config:: usage) ,
101101 } ,
102102 Command {
103103 cmd : "pkg" ,
104- action : CallMain ( "rustpkg" , rustpkg:: main ) ,
104+ action : CallMain ( "rustpkg" , rustpkg:: main_args ) ,
105105 usage_line : "download, build, install rust packages" ,
106106 usage_full : UsgCall ( rustpkg:: usage:: general) ,
107107 } ,
108108 Command {
109109 cmd : "sketch" ,
110- action : CallMain ( "rusti" , rusti:: main ) ,
110+ action : CallMain ( "rusti" , rusti:: main_args ) ,
111111 usage_line : "run a rust interpreter" ,
112112 usage_full : UsgStr ( "\n Usage:\t rusti" ) ,
113113 } ,
@@ -164,7 +164,7 @@ fn cmd_test(args: &[~str]) -> ValidUsage {
164164 [ ref filename] => {
165165 let test_exec = Path ( * filename) . filestem ( ) . unwrap ( ) + "test~" ;
166166 invoke ( "rustc" , & [ ~"--test", filename. to_owned ( ) ,
167- ~"-o", test_exec. to_owned ( ) ] , rustc:: main ) ;
167+ ~"-o", test_exec. to_owned ( ) ] , rustc:: main_args ) ;
168168 let exit_code = run:: process_status( ~". /" + test_exec, [ ] ) ;
169169 Valid ( exit_code)
170170 }
@@ -177,19 +177,18 @@ fn cmd_run(args: &[~str]) -> ValidUsage {
177177 [ ref filename, ..prog_args] => {
178178 let exec = Path ( * filename) . filestem ( ) . unwrap ( ) + "~" ;
179179 invoke ( "rustc" , & [ filename. to_owned ( ) , ~"-o", exec. to_owned ( ) ] ,
180- rustc:: main ) ;
180+ rustc:: main_args ) ;
181181 let exit_code = run:: process_status ( ~". /"+exec, prog_args) ;
182182 Valid ( exit_code)
183183 }
184184 _ => Invalid
185185 }
186186}
187187
188- fn invoke ( prog : & str , args : & [ ~str ] , f : & fn ( ) ) {
188+ fn invoke ( prog : & str , args : & [ ~str ] , f : & fn ( & [ ~ str ] ) ) {
189189 let mut osargs = ~[ prog. to_owned ( ) ] ;
190190 osargs. push_all_move ( args. to_owned ( ) ) ;
191- os:: set_args ( osargs) ;
192- f ( ) ;
191+ f ( osargs) ;
193192}
194193
195194fn do_command ( command : & Command , args : & [ ~str ] ) -> ValidUsage {
0 commit comments