1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

Merge pull request #105 from Arcterus/master

Update for latest Rust
This commit is contained in:
Heather 2014-02-24 07:25:04 +03:00
commit 26c5d7e245
5 changed files with 22 additions and 20 deletions

View file

@ -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 {

12
env/env.rs vendored
View file

@ -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,9 +190,8 @@ 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,
@ -198,11 +199,8 @@ fn main() {
}), }),
Err(_) => std::os::set_exit_status(1) Err(_) => std::os::set_exit_status(1)
} }
} } else {
[] => {
// no program provided // no program provided
print_env(opts.null); print_env(opts.null);
} }
}
} }

View file

@ -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;

View file

@ -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)];

View file

@ -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;