diff --git a/src/groups/groups.rs b/src/groups/groups.rs index 8ab0c6748..91ce6aa6d 100644 --- a/src/groups/groups.rs +++ b/src/groups/groups.rs @@ -1,5 +1,5 @@ #![crate_name = "groups"] -#![feature(collections, rustc_private)] +#![feature(rustc_private)] /* * This file is part of the uutils coreutils package. @@ -12,12 +12,9 @@ */ extern crate getopts; -use getopts::{ - optflag, - getopts, - usage -}; use c_types::{get_pw_from_args, group}; +use getopts::{getopts, optflag, usage}; +use std::io::Write; #[path = "../common/util.rs"] #[macro_use] mod util; #[path = "../common/c_types.rs"] mod c_types; @@ -33,7 +30,7 @@ pub fn uumain(args: Vec) -> i32 { optflag("V", "version", "display version information and exit") ]; - let matches = match getopts(args.tail(), &options) { + let matches = match getopts(&args[1..], &options) { Ok(m) => { m }, Err(f) => { show_error!("{}", f); diff --git a/src/logname/logname.rs b/src/logname/logname.rs index 85571165b..062726dbd 100644 --- a/src/logname/logname.rs +++ b/src/logname/logname.rs @@ -1,5 +1,5 @@ #![crate_name = "logname"] -#![feature(collections, core, old_io, rustc_private, std_misc)] +#![feature(rustc_private)] /* * This file is part of the uutils coreutils package. @@ -12,14 +12,11 @@ /* last synced with: logname (GNU coreutils) 8.22 */ -#![allow(non_camel_case_types)] - extern crate getopts; extern crate libc; use std::ffi::CStr; -use std::old_io::print; -use libc::c_char; +use std::io::Write; #[path = "../common/util.rs"] #[macro_use] mod util; @@ -30,12 +27,12 @@ extern { fn get_userlogin() -> Option { unsafe { - let login: *const libc::c_char = getlogin(); - if login.is_null() { - None - } else { - Some(String::from_utf8_lossy(CStr::from_ptr(login).to_bytes()).to_string()) - } + let login: *const libc::c_char = getlogin(); + if login.is_null() { + None + } else { + Some(String::from_utf8_lossy(CStr::from_ptr(login).to_bytes()).to_string()) + } } } @@ -57,7 +54,7 @@ pub fn uumain(args: Vec) -> i32 { getopts::optflag("V", "version", "output version information and exit"), ]; - let matches = match getopts::getopts(args.tail(), &opts) { + let matches = match getopts::getopts(&args[1..], &opts) { Ok(m) => m, Err(f) => crash!(1, "Invalid options\n{}", f) }; @@ -68,7 +65,7 @@ pub fn uumain(args: Vec) -> i32 { println!("Usage:"); println!(" {}", program); println!(""); - print(getopts::usage("print user's login name", &opts).as_slice()); + print!("{}", getopts::usage("print user's login name", &opts)); return 0; } if matches.opt_present("version") { @@ -82,8 +79,8 @@ pub fn uumain(args: Vec) -> i32 { } fn exec() { - match get_userlogin() { - Some(userlogin) => println!("{}", userlogin), - None => println!("{}: no login name", NAME) - } + match get_userlogin() { + Some(userlogin) => println!("{}", userlogin), + None => println!("{}: no login name", NAME) + } }