mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2026-01-18 19:21:09 +00:00
Fix id.
This commit is contained in:
parent
b4f061b4da
commit
c93440170d
2 changed files with 6 additions and 11 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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<String>) -> i32 {
|
||||
let args_t = args.tail();
|
||||
let args_t = &args[1..];
|
||||
|
||||
let options = [
|
||||
optflag("h", "", "Show help"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue