mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 19:47:45 +00:00
commit
26c5d7e245
5 changed files with 22 additions and 20 deletions
6
du/du.rs
6
du/du.rs
|
@ -11,16 +11,16 @@
|
||||||
|
|
||||||
#[feature(macro_rules)];
|
#[feature(macro_rules)];
|
||||||
|
|
||||||
extern crate extra;
|
|
||||||
extern crate getopts;
|
extern crate getopts;
|
||||||
extern crate sync;
|
extern crate sync;
|
||||||
|
extern crate time;
|
||||||
|
|
||||||
use std::os;
|
use std::os;
|
||||||
use std::io::fs;
|
use std::io::fs;
|
||||||
use std::io::FileStat;
|
use std::io::FileStat;
|
||||||
use std::option::Option;
|
use std::option::Option;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use extra::time::Timespec;
|
use time::Timespec;
|
||||||
use sync::{Arc, Future};
|
use sync::{Arc, Future};
|
||||||
|
|
||||||
#[path = "../util.rs"]
|
#[path = "../util.rs"]
|
||||||
|
@ -337,7 +337,7 @@ Try 'du --help' for more information.");
|
||||||
((time / 1000) as i64, (time % 1000 * 1000000) as i32)
|
((time / 1000) as i64, (time % 1000 * 1000000) as i32)
|
||||||
};
|
};
|
||||||
let time_spec = Timespec::new(secs, nsecs);
|
let time_spec = Timespec::new(secs, nsecs);
|
||||||
extra::time::at(time_spec).strftime(time_format_str)
|
time::at(time_spec).strftime(time_format_str)
|
||||||
};
|
};
|
||||||
print!("{:<10} {:<30} {}", convert_size(size), time_str, stat.path.display());
|
print!("{:<10} {:<30} {}", convert_size(size), time_str, stat.path.display());
|
||||||
} else {
|
} else {
|
||||||
|
|
28
env/env.rs
vendored
28
env/env.rs
vendored
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
/* last synced with: env (GNU coreutils) 8.13 */
|
/* last synced with: env (GNU coreutils) 8.13 */
|
||||||
|
|
||||||
|
#[allow(non_camel_case_types)];
|
||||||
|
|
||||||
struct options {
|
struct options {
|
||||||
ignore_env: bool,
|
ignore_env: bool,
|
||||||
null: bool,
|
null: bool,
|
||||||
|
@ -188,21 +190,17 @@ fn main() {
|
||||||
std::os::setenv(name.as_slice(), val.as_slice())
|
std::os::setenv(name.as_slice(), val.as_slice())
|
||||||
}
|
}
|
||||||
|
|
||||||
match opts.program {
|
if opts.program.len() >= 1 {
|
||||||
[ref prog, ..args] => {
|
match std::run::process_status(opts.program[0].as_slice(), opts.program.slice_from(1)) {
|
||||||
match std::run::process_status(prog.as_slice(), args.as_slice()) {
|
Ok(exit) =>
|
||||||
Ok(exit) =>
|
std::os::set_exit_status(match exit {
|
||||||
std::os::set_exit_status(match exit {
|
std::io::process::ExitStatus(s) => s,
|
||||||
std::io::process::ExitStatus(s) => s,
|
_ => 1
|
||||||
_ => 1
|
}),
|
||||||
}),
|
Err(_) => std::os::set_exit_status(1)
|
||||||
Err(_) => std::os::set_exit_status(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[] => {
|
|
||||||
// no program provided
|
|
||||||
print_env(opts.null);
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// no program provided
|
||||||
|
print_env(opts.null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
4
id/id.rs
4
id/id.rs
|
@ -13,6 +13,8 @@
|
||||||
* http://www.opensource.apple.com/source/shell_cmds/shell_cmds-118/id/id.c
|
* http://www.opensource.apple.com/source/shell_cmds/shell_cmds-118/id/id.c
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#[allow(non_camel_case_types)];
|
||||||
|
|
||||||
extern crate getopts;
|
extern crate getopts;
|
||||||
|
|
||||||
use std::{libc, os, vec};
|
use std::{libc, os, vec};
|
||||||
|
@ -41,7 +43,7 @@ struct c_group {
|
||||||
|
|
||||||
#[cfg(not(target_os = "linux"))]
|
#[cfg(not(target_os = "linux"))]
|
||||||
mod audit {
|
mod audit {
|
||||||
pub use std::unstable::intrinsics::uninit;
|
pub use std::mem::uninit;
|
||||||
use std::libc::{uid_t, pid_t, c_int, c_uint, uint64_t, dev_t};
|
use std::libc::{uid_t, pid_t, c_int, c_uint, uint64_t, dev_t};
|
||||||
|
|
||||||
pub type au_id_t = uid_t;
|
pub type au_id_t = uid_t;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
/* last synced with: whoami (GNU coreutils) 8.22 */
|
/* last synced with: whoami (GNU coreutils) 8.22 */
|
||||||
|
|
||||||
// Allow dead code here in order to keep all fields, constants here, for consistency.
|
// Allow dead code here in order to keep all fields, constants here, for consistency.
|
||||||
#[allow(dead_code)];
|
#[allow(dead_code, non_camel_case_types)];
|
||||||
|
|
||||||
#[feature(macro_rules, globs)];
|
#[feature(macro_rules, globs)];
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
/* last synced with: whoami (GNU coreutils) 8.21 */
|
/* last synced with: whoami (GNU coreutils) 8.21 */
|
||||||
|
|
||||||
|
#[allow(non_camel_case_types)];
|
||||||
|
|
||||||
#[feature(macro_rules)];
|
#[feature(macro_rules)];
|
||||||
|
|
||||||
extern crate extra;
|
extern crate extra;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue