os::args -> env::args

This commit is contained in:
Michael Gehring 2015-02-06 15:04:02 +01:00
parent e7b647171f
commit 910fd61070
4 changed files with 9 additions and 7 deletions

View file

@ -1,7 +1,6 @@
#![feature(core, env, io, os, path)]
use std::env;
use std::old_io::{File, Truncate, ReadWrite};
use std::os;
use std::old_path::Path;
static TEMPLATE: &'static str = "\
@ -9,16 +8,19 @@ static TEMPLATE: &'static str = "\
extern crate \"@UTIL_CRATE@\" as uu@UTIL_CRATE@;
use std::env;
use std::os;
use uu@UTIL_CRATE@::uumain;
fn args() -> Vec<String> {
env::args().map(|a| a.into_string().unwrap()).collect()
}
fn main() {
env::set_exit_status(uumain(os::args()));
env::set_exit_status(uumain(args()));
}
";
fn main() {
let args = os::args();
let args : Vec<String> = env::args().map(|a| a.into_string().unwrap()).collect();
if args.len() != 3 {
println!("usage: mkbuild <crate> <outfile>");
env::set_exit_status(1);

View file

@ -6,7 +6,7 @@ use std::os;
use std::old_path::Path;
fn main() {
let args = os::args();
let args : Vec<String> = env::args().map(|a| a.into_string().unwrap()).collect();
if args.len() < 3 {
println!("usage: mkuutils <outfile> <crates>");
env::set_exit_status(1);

View file

@ -150,5 +150,5 @@ fn with_path<F, T>(path: &Path, mut cb: F) -> IoResult<T> where F: FnMut() -> Io
}
fn warn(message: &str) {
error!("{}: {}", os::args()[0], message);
error!("tee: {}", message);
}

View file

@ -42,7 +42,7 @@ fn usage(cmap: &HashMap<&'static str, fn(Vec<String>) -> i32>) {
fn main() {
let umap = util_map();
let mut args = os::args();
let mut args : Vec<String> = env::args().map(|a| a.into_string().unwrap()).collect();
// try binary name as util name.
let binary = Path::new(args[0].as_slice());