mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
getpwuid is linux
platform only currently.
This commit is contained in:
parent
8161bb7fe1
commit
1606770a3e
1 changed files with 6 additions and 4 deletions
10
src/ls/ls.rs
10
src/ls/ls.rs
|
@ -164,7 +164,9 @@ fn cstr2string(cstr: *const c_char) -> String {
|
|||
unsafe { String::from_utf8_lossy(CStr::from_ptr(cstr).to_bytes()).to_string() }
|
||||
}
|
||||
|
||||
#[cfg(target_family = "unix")]
|
||||
// Currently getpwuid is `linux` target only. If it's broken out into
|
||||
// a posix-compliant attribute this can be updated...
|
||||
#[cfg(target_family = "linux")]
|
||||
fn display_uname(metadata: &Metadata) -> String {
|
||||
use std::os::unix::fs::MetadataExt;
|
||||
|
||||
|
@ -176,7 +178,7 @@ fn display_uname(metadata: &Metadata) -> String {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(target_family = "unix")]
|
||||
#[cfg(target_family = "linux")]
|
||||
fn display_group(metadata: &Metadata) -> String {
|
||||
use std::os::unix::fs::MetadataExt;
|
||||
|
||||
|
@ -188,13 +190,13 @@ fn display_group(metadata: &Metadata) -> String {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(target_family = "windows")]
|
||||
#[cfg(not(target_family = "linux"))]
|
||||
#[allow(unused_variables)]
|
||||
fn display_uname(metadata: &Metadata) -> String {
|
||||
"somebody".to_string()
|
||||
}
|
||||
|
||||
#[cfg(target_family = "windows")]
|
||||
#[cfg(not(target_family = "linux"))]
|
||||
#[allow(unused_variables)]
|
||||
fn display_group(metadata: &Metadata) -> String {
|
||||
"somegroup".to_string()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue