From 6911c7e2ce6688266fa3e6850eb598b3dff4c8f7 Mon Sep 17 00:00:00 2001 From: Joseph Crail Date: Wed, 6 May 2015 13:38:45 -0400 Subject: [PATCH] Fix link. --- src/link/link.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/link/link.rs b/src/link/link.rs index 4454a9fe4..6a4b2f013 100644 --- a/src/link/link.rs +++ b/src/link/link.rs @@ -1,5 +1,5 @@ #![crate_name = "link"] -#![feature(collections, core, old_io, old_path, rustc_private)] +#![feature(rustc_private)] /* * This file is part of the uutils coreutils package. @@ -12,8 +12,9 @@ extern crate getopts; -use std::old_io::fs::link; -use std::old_path::Path; +use std::io::Write; +use std::fs::hard_link; +use std::path::Path; #[path="../common/util.rs"] #[macro_use] @@ -28,7 +29,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(err) => panic!("{}", err), }; @@ -44,17 +45,17 @@ pub fn uumain(args: Vec) -> i32 { println!("Usage:"); println!(" {} [OPTIONS] FILE1 FILE2", NAME); println!(""); - print!("{}", getopts::usage("Create a link named FILE2 to FILE1.", opts.as_slice()).as_slice()); + print!("{}", getopts::usage("Create a link named FILE2 to FILE1.", &opts)); if matches.free.len() != 2 { return 1; } return 0; } - let old = Path::new(matches.free[0].as_slice()); - let new = Path::new(matches.free[1].as_slice()); + let old = Path::new(&matches.free[0]); + let new = Path::new(&matches.free[1]); - match link(&old, &new) { + match hard_link(old, new) { Ok(_) => 0, Err(err) => { show_error!("{}", err);