mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
@@ -39,7 +39,8 @@ UNIX_PROGS := \
|
||||
whoami \
|
||||
tty \
|
||||
groups \
|
||||
id
|
||||
id \
|
||||
uptime
|
||||
|
||||
ifneq ($(OS),Windows_NT)
|
||||
PROGS := $(PROGS) $(UNIX_PROGS)
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
extern crate extra;
|
||||
extern crate getopts;
|
||||
|
||||
use std::io::{print, println};
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
/* last synced with: cat (GNU coreutils) 8.13 */
|
||||
|
||||
extern crate extra;
|
||||
extern crate getopts;
|
||||
|
||||
use std::os;
|
||||
|
||||
@@ -32,6 +32,18 @@ pub struct c_group {
|
||||
gr_name: *c_char /* group name */
|
||||
}
|
||||
|
||||
pub struct c_tm {
|
||||
tm_sec: c_int, /* seconds */
|
||||
tm_min: c_int, /* minutes */
|
||||
tm_hour: c_int, /* hours */
|
||||
tm_mday: c_int, /* day of the month */
|
||||
tm_mon: c_int, /* month */
|
||||
tm_year: c_int, /* year */
|
||||
tm_wday: c_int, /* day of the week */
|
||||
tm_yday: c_int, /* day in the year */
|
||||
tm_isdst: c_int /* daylight saving time */
|
||||
}
|
||||
|
||||
extern {
|
||||
pub fn getpwuid(uid: c_int) -> *c_passwd;
|
||||
pub fn getpwnam(login: *c_char) -> *c_passwd;
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
#[allow(non_camel_case_types)];
|
||||
|
||||
pub use self::utmpx::{DEFAULT_FILE,USER_PROCESS,c_utmp};
|
||||
#[cfg(target_os = "linux")]
|
||||
mod utmpx {
|
||||
use std::libc;
|
||||
|
||||
pub static DEFAULT_FILE: &'static str = "/var/run/utmp";
|
||||
|
||||
pub static UT_LINESIZE: uint = 32;
|
||||
pub static UT_NAMESIZE: uint = 32;
|
||||
pub static UT_IDSIZE: uint = 4;
|
||||
pub static UT_HOSTSIZE: uint = 256;
|
||||
|
||||
pub static EMPTY: libc::c_short = 0;
|
||||
pub static RUN_LVL: libc::c_short = 1;
|
||||
pub static BOOT_TIME: libc::c_short = 2;
|
||||
pub static NEW_TIME: libc::c_short = 3;
|
||||
pub static OLD_TIME: libc::c_short = 4;
|
||||
pub static INIT_PROCESS: libc::c_short = 5;
|
||||
pub static LOGIN_PROCESS: libc::c_short = 6;
|
||||
pub static USER_PROCESS: libc::c_short = 7;
|
||||
pub static DEAD_PROCESS: libc::c_short = 8;
|
||||
pub static ACCOUNTING: libc::c_short = 9;
|
||||
|
||||
pub struct c_exit_status {
|
||||
e_termination: libc::c_short,
|
||||
e_exit: libc::c_short,
|
||||
}
|
||||
|
||||
pub struct c_utmp {
|
||||
ut_type: libc::c_short,
|
||||
ut_pid: libc::pid_t,
|
||||
ut_line: [libc::c_char, ..UT_LINESIZE],
|
||||
ut_id: [libc::c_char, ..UT_IDSIZE],
|
||||
|
||||
ut_user: [libc::c_char, ..UT_NAMESIZE],
|
||||
ut_host: [libc::c_char, ..UT_HOSTSIZE],
|
||||
ut_exit: c_exit_status,
|
||||
ut_session: libc::c_long,
|
||||
ut_tv: libc::timeval,
|
||||
|
||||
ut_addr_v6: [libc::int32_t, ..4],
|
||||
__unused: [libc::c_char, ..20],
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
mod utmpx {
|
||||
use std::libc;
|
||||
|
||||
pub static DEFAULT_FILE: &'static str = "/var/run/utmpx";
|
||||
|
||||
pub static UT_LINESIZE: uint = 32;
|
||||
pub static UT_NAMESIZE: uint = 256;
|
||||
pub static UT_IDSIZE: uint = 4;
|
||||
pub static UT_HOSTSIZE: uint = 256;
|
||||
|
||||
pub static EMPTY: libc::c_short = 0;
|
||||
pub static RUN_LVL: libc::c_short = 1;
|
||||
pub static BOOT_TIME: libc::c_short = 2;
|
||||
pub static OLD_TIME: libc::c_short = 3;
|
||||
pub static NEW_TIME: libc::c_short = 4;
|
||||
pub static INIT_PROCESS: libc::c_short = 5;
|
||||
pub static LOGIN_PROCESS: libc::c_short = 6;
|
||||
pub static USER_PROCESS: libc::c_short = 7;
|
||||
pub static DEAD_PROCESS: libc::c_short = 8;
|
||||
pub static ACCOUNTING: libc::c_short = 9;
|
||||
|
||||
pub struct c_exit_status {
|
||||
e_termination: libc::c_short,
|
||||
e_exit: libc::c_short,
|
||||
}
|
||||
|
||||
pub struct c_utmp {
|
||||
ut_user: [libc::c_char, ..UT_NAMESIZE],
|
||||
ut_id: [libc::c_char, ..UT_IDSIZE],
|
||||
ut_line: [libc::c_char, ..UT_LINESIZE],
|
||||
ut_pid: libc::pid_t,
|
||||
ut_type: libc::c_short,
|
||||
ut_tv: libc::timeval,
|
||||
ut_host: [libc::c_char, ..UT_HOSTSIZE],
|
||||
__unused: [libc::c_char, ..16]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
extern crate extra;
|
||||
extern crate getopts;
|
||||
|
||||
use std::os;
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
extern crate extra;
|
||||
extern crate getopts;
|
||||
|
||||
use std::os;
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
* Synced with: https://raw.github.com/avsm/src/master/usr.bin/head/head.c
|
||||
*/
|
||||
|
||||
extern crate extra;
|
||||
extern crate getopts;
|
||||
|
||||
use std::os;
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
* https://www.opensource.apple.com/source/shell_cmds/shell_cmds-170/hostname/hostname.c?txt
|
||||
*/
|
||||
|
||||
extern crate extra;
|
||||
extern crate getopts;
|
||||
|
||||
use std::{os,libc,vec,str};
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
#[feature(macro_rules)];
|
||||
|
||||
extern crate extra;
|
||||
extern crate getopts;
|
||||
|
||||
use std::io::{print, println};
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#[feature(macro_rules)];
|
||||
|
||||
extern crate extra;
|
||||
extern crate getopts;
|
||||
|
||||
use std::os;
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
#[feature(macro_rules)];
|
||||
|
||||
extern crate extra;
|
||||
extern crate getopts;
|
||||
|
||||
use std::os;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#[feature(macro_rules)];
|
||||
|
||||
extern crate extra;
|
||||
extern crate getopts;
|
||||
|
||||
use std::os;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#[feature(macro_rules)];
|
||||
|
||||
extern crate extra;
|
||||
extern crate getopts;
|
||||
|
||||
use std::os;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#[feature(macro_rules)];
|
||||
|
||||
extern crate extra;
|
||||
extern crate getopts;
|
||||
|
||||
use std::os;
|
||||
|
||||
+1
-3
@@ -5,11 +5,9 @@
|
||||
// TODO: Make -w flag work with decimals
|
||||
// TODO: Support -f flag
|
||||
|
||||
extern crate extra;
|
||||
extern crate getopts;
|
||||
|
||||
use std::os;
|
||||
use std::cmp::max;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
mod util;
|
||||
@@ -99,7 +97,7 @@ fn done_printing(next: f32, step: f32, last: f32) -> bool {
|
||||
|
||||
fn print_seq(first: f32, step: f32, last: f32, separator: ~str, terminator: ~str, pad: bool) {
|
||||
let mut i = first;
|
||||
let maxlen = max(first, last).to_str().len();
|
||||
let maxlen = first.max(last).to_str().len();
|
||||
while !done_printing(i, step, last) {
|
||||
let ilen = i.to_str().len();
|
||||
if pad && ilen < maxlen {
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#[feature(macro_rules)];
|
||||
|
||||
extern crate extra;
|
||||
extern crate getopts;
|
||||
|
||||
use std::num;
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
extern crate extra;
|
||||
extern crate getopts;
|
||||
|
||||
use std::io::{println, stdin, stdout, Append, File, Truncate, Write};
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#[feature(macro_rules)];
|
||||
|
||||
extern crate extra;
|
||||
extern crate getopts;
|
||||
|
||||
use std::io::{File, Open, ReadWrite, fs};
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
#[feature(macro_rules)];
|
||||
|
||||
extern crate extra;
|
||||
extern crate getopts;
|
||||
|
||||
use std::{libc,str,os};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user