mirror of
https://github.com/uutils/coreutils
synced 2024-11-16 01:38:04 +00:00
commit
19bb2e1ccd
8 changed files with 20 additions and 20 deletions
2
deps/regex
vendored
2
deps/regex
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 90ef3c4b58140d672ed97cdf45e59592d122368e
|
||||
Subproject commit 8b44176a91326ec0b5e33bc36443ba00cb528c16
|
2
deps/rust-crypto
vendored
2
deps/rust-crypto
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 6e70e4b98137f247f8d30b698c179d2f973dc23b
|
||||
Subproject commit d06c8672a212add38edfcc5b504e4b4cb30c5a8b
|
|
@ -95,8 +95,8 @@ pub fn uumain(args: Vec<String>) -> isize {
|
|||
set_context(&newroot, &opts);
|
||||
|
||||
unsafe {
|
||||
let executable = CString::from_slice(command[0].as_bytes()).as_slice_with_nul().as_ptr();
|
||||
let mut command_parts: Vec<*const i8> = command.iter().map(|x| CString::from_slice(x.as_bytes()).as_slice_with_nul().as_ptr()).collect();
|
||||
let executable = CString::from_slice(command[0].as_bytes()).as_bytes_with_nul().as_ptr();
|
||||
let mut command_parts: Vec<*const u8> = command.iter().map(|x| CString::from_slice(x.as_bytes()).as_bytes_with_nul().as_ptr()).collect();
|
||||
command_parts.push(std::ptr::null());
|
||||
execvp(executable as *const libc::c_char, command_parts.as_ptr() as *mut *const libc::c_char) as isize
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ fn enter_chroot(root: &Path) {
|
|||
let root_str = root.display();
|
||||
std::os::change_dir(root).unwrap();
|
||||
let err = unsafe {
|
||||
chroot(CString::from_slice(b".").as_slice_with_nul().as_ptr() as *const libc::c_char)
|
||||
chroot(CString::from_slice(b".").as_bytes_with_nul().as_ptr() as *const libc::c_char)
|
||||
};
|
||||
if err != 0 {
|
||||
crash!(1, "cannot chroot to {}: {}", root_str, strerror(err).as_slice())
|
||||
|
|
|
@ -134,7 +134,7 @@ pub fn get_pw_from_args(free: &Vec<String>) -> Option<c_passwd> {
|
|||
} else {
|
||||
let pw_pointer = unsafe {
|
||||
let cstr = CString::from_slice(username.as_bytes());
|
||||
getpwnam(cstr.as_slice_with_nul().as_ptr())
|
||||
getpwnam(cstr.as_bytes_with_nul().as_ptr() as *const i8)
|
||||
};
|
||||
if !pw_pointer.is_null() {
|
||||
Some(unsafe { read(pw_pointer) })
|
||||
|
@ -153,7 +153,7 @@ pub fn get_group(groupname: &str) -> Option<c_group> {
|
|||
} else {
|
||||
unsafe {
|
||||
let cstr = CString::from_slice(groupname.as_bytes());
|
||||
getgrnam(cstr.as_slice_with_nul().as_ptr() as *const c_char)
|
||||
getgrnam(cstr.as_bytes_with_nul().as_ptr() as *const c_char)
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -199,7 +199,7 @@ unsafe fn get_group_list_internal(name: *const c_char, gid: gid_t, groups: *mut
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_groups() -> Result<Vec<gid_t>, usize> {
|
||||
pub fn get_groups() -> Result<Vec<gid_t>, i32> {
|
||||
let ngroups = unsafe { getgroups(0, null_mut()) };
|
||||
if ngroups == -1 {
|
||||
return Err(os::errno());
|
||||
|
|
|
@ -31,7 +31,7 @@ struct EchoOptions {
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn to_char(bytes: &Vec<u8>, base: usize) -> char {
|
||||
fn to_char(bytes: &Vec<u8>, base: u32) -> char {
|
||||
from_str_radix::<usize>(from_utf8(bytes.as_slice()).unwrap(), base).unwrap() as u8 as char
|
||||
}
|
||||
|
||||
|
@ -52,10 +52,10 @@ fn isodigit(c: u8) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
fn convert_str(string: &[u8], index: usize, base: usize) -> (char, usize) {
|
||||
fn convert_str(string: &[u8], index: usize, base: u32) -> (char, usize) {
|
||||
let (max_digits, is_legal_digit) : (usize, fn(u8) -> bool) = match base {
|
||||
8us => (3, isodigit),
|
||||
16us => (2, isxdigit),
|
||||
8 => (3, isodigit),
|
||||
16 => (2, isxdigit),
|
||||
_ => panic!(),
|
||||
};
|
||||
|
||||
|
@ -202,7 +202,7 @@ pub fn uumain(args: Vec<String>) -> isize {
|
|||
't' => print!("\t"),
|
||||
'v' => print!("\x0B"),
|
||||
'x' => {
|
||||
let (c, num_char_used) = convert_str(string.as_bytes(), index + 1, 16us);
|
||||
let (c, num_char_used) = convert_str(string.as_bytes(), index + 1, 16);
|
||||
if num_char_used == 0 {
|
||||
print!("\\x");
|
||||
} else {
|
||||
|
@ -213,7 +213,7 @@ pub fn uumain(args: Vec<String>) -> isize {
|
|||
}
|
||||
},
|
||||
'0' => {
|
||||
let (c, num_char_used) = convert_str(string.as_bytes(), index + 1, 8us);
|
||||
let (c, num_char_used) = convert_str(string.as_bytes(), index + 1, 8);
|
||||
if num_char_used == 0 {
|
||||
print!("\0");
|
||||
} else {
|
||||
|
@ -224,7 +224,7 @@ pub fn uumain(args: Vec<String>) -> isize {
|
|||
}
|
||||
}
|
||||
_ => {
|
||||
let (esc_c, num_char_used) = convert_str(string.as_bytes(), index, 8us);
|
||||
let (esc_c, num_char_used) = convert_str(string.as_bytes(), index, 8);
|
||||
if num_char_used == 0 {
|
||||
print!("\\{}", c);
|
||||
} else {
|
||||
|
|
|
@ -243,7 +243,7 @@ fn num_prefix(i: usize, width: usize) -> String {
|
|||
let div = Int::pow(10 as usize, w);
|
||||
let r = n / div;
|
||||
n -= r * div;
|
||||
c.push(char::from_digit(r, 10).unwrap());
|
||||
c.push(char::from_digit(r as u32, 10).unwrap());
|
||||
}
|
||||
c
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ use std::old_io::fs::File;
|
|||
use std::old_path::Path;
|
||||
use std::str::from_utf8;
|
||||
use getopts::{optopt, optflag, getopts, usage};
|
||||
use std::collections::ring_buf::RingBuf;
|
||||
use std::collections::VecDeque;
|
||||
use std::old_io::timer::sleep;
|
||||
use std::time::duration::Duration;
|
||||
|
||||
|
@ -241,7 +241,7 @@ macro_rules! tail_impl (
|
|||
// read through each line and store them in a ringbuffer that always contains
|
||||
// count lines/chars. When reaching the end of file, output the data in the
|
||||
// ringbuf.
|
||||
let mut ringbuf: RingBuf<$kind> = RingBuf::new();
|
||||
let mut ringbuf: VecDeque<$kind> = VecDeque::new();
|
||||
let data = $reader.$kindfn().skip(
|
||||
if $beginning {
|
||||
let temp = $count;
|
||||
|
|
|
@ -15,7 +15,7 @@ extern crate getopts;
|
|||
|
||||
use getopts::OptGroup;
|
||||
use std::char::from_u32;
|
||||
use std::collections::{BitvSet, VecMap};
|
||||
use std::collections::{BitSet, VecMap};
|
||||
use std::old_io::{BufferedReader, print};
|
||||
use std::old_io::stdio::{stdin_raw, stdout};
|
||||
use std::iter::FromIterator;
|
||||
|
@ -89,7 +89,7 @@ fn expand_set(s: &str) -> Vec<char> {
|
|||
}
|
||||
|
||||
fn delete(set: Vec<char>, complement: bool) {
|
||||
let mut bset = BitvSet::new();
|
||||
let mut bset = BitSet::new();
|
||||
let mut out = stdout();
|
||||
|
||||
for &c in set.iter() {
|
||||
|
|
Loading…
Reference in a new issue