mirror of
https://github.com/uutils/coreutils
synced 2024-11-16 01:38:04 +00:00
Flag uname/group functions as unix-specific and add NO-OP Windows versions.
This commit is contained in:
parent
ce7f23bcc4
commit
8161bb7fe1
1 changed files with 14 additions and 0 deletions
14
src/ls/ls.rs
14
src/ls/ls.rs
|
@ -164,6 +164,7 @@ fn cstr2string(cstr: *const c_char) -> String {
|
|||
unsafe { String::from_utf8_lossy(CStr::from_ptr(cstr).to_bytes()).to_string() }
|
||||
}
|
||||
|
||||
#[cfg(target_family = "unix")]
|
||||
fn display_uname(metadata: &Metadata) -> String {
|
||||
use std::os::unix::fs::MetadataExt;
|
||||
|
||||
|
@ -175,6 +176,7 @@ fn display_uname(metadata: &Metadata) -> String {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(target_family = "unix")]
|
||||
fn display_group(metadata: &Metadata) -> String {
|
||||
use std::os::unix::fs::MetadataExt;
|
||||
|
||||
|
@ -186,6 +188,18 @@ fn display_group(metadata: &Metadata) -> String {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(target_family = "windows")]
|
||||
#[allow(unused_variables)]
|
||||
fn display_uname(metadata: &Metadata) -> String {
|
||||
"somebody".to_string()
|
||||
}
|
||||
|
||||
#[cfg(target_family = "windows")]
|
||||
#[allow(unused_variables)]
|
||||
fn display_group(metadata: &Metadata) -> String {
|
||||
"somegroup".to_string()
|
||||
}
|
||||
|
||||
fn display_file_size(metadata: &Metadata, options: &getopts::Matches) -> String {
|
||||
if options.opt_present("human-readable") {
|
||||
convert(metadata.len() as f64)
|
||||
|
|
Loading…
Reference in a new issue