From c93440170da8935a35fbc1e6f0c319bf022fbc59 Mon Sep 17 00:00:00 2001 From: Joseph Crail Date: Sun, 17 May 2015 14:59:04 -0400 Subject: [PATCH] Fix id. --- src/common/c_types.rs | 12 +++--------- src/id/id.rs | 5 +++-- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/common/c_types.rs b/src/common/c_types.rs index 8ff1cc8c9..d41871257 100644 --- a/src/common/c_types.rs +++ b/src/common/c_types.rs @@ -1,4 +1,4 @@ -#![allow(dead_code, non_camel_case_types)] +#![allow(dead_code, non_camel_case_types, raw_pointer_derive)] extern crate libc; @@ -24,6 +24,7 @@ use std::ptr::{null_mut, read}; #[cfg(any(target_os = "macos", target_os = "freebsd"))] #[repr(C)] +#[derive(Clone, Copy)] pub struct c_passwd { pub pw_name: *const c_char, /* user name */ pub pw_passwd: *const c_char, /* user name */ @@ -39,6 +40,7 @@ pub struct c_passwd { #[cfg(target_os = "linux")] #[repr(C)] +#[derive(Clone, Copy)] pub struct c_passwd { pub pw_name: *const c_char, /* user name */ pub pw_passwd: *const c_char, /* user name */ @@ -49,8 +51,6 @@ pub struct c_passwd { pub pw_shell: *const c_char, } -//impl Copy for c_passwd {} - #[cfg(any(target_os = "macos", target_os = "freebsd"))] #[repr(C)] pub struct utsname { @@ -72,8 +72,6 @@ pub struct utsname { pub domainame: [c_char; 65] } -//impl Copy for utsname {} - #[repr(C)] pub struct c_group { pub gr_name: *const c_char, // group name @@ -82,8 +80,6 @@ pub struct c_group { pub gr_mem: *const *const c_char, // member list } -//impl Copy for c_group {} - #[repr(C)] pub struct c_tm { pub tm_sec: c_int, /* seconds */ @@ -97,8 +93,6 @@ pub struct c_tm { pub tm_isdst: c_int /* daylight saving time */ } -//impl Copy for c_tm {} - extern { pub fn getpwuid(uid: uid_t) -> *const c_passwd; pub fn getpwnam(login: *const c_char) -> *const c_passwd; diff --git a/src/id/id.rs b/src/id/id.rs index 0918b9471..2b8b6fb5a 100644 --- a/src/id/id.rs +++ b/src/id/id.rs @@ -1,5 +1,5 @@ #![crate_name = "id"] -#![feature(collections, core, rustc_private, std_misc)] +#![feature(rustc_private)] /* * This file is part of the uutils coreutils package. @@ -18,6 +18,7 @@ extern crate getopts; extern crate libc; +use std::io::Write; use std::ffi::CStr; use std::ptr::read; use libc::{ @@ -86,7 +87,7 @@ extern { static NAME: &'static str = "id"; pub fn uumain(args: Vec) -> i32 { - let args_t = args.tail(); + let args_t = &args[1..]; let options = [ optflag("h", "", "Show help"),