1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-08-02 05:57:46 +00:00

Merge pull request #530 from ebfe/fix-build

Fix build with alpha 2
This commit is contained in:
Heather 2015-02-22 13:25:01 +03:00
commit 19bb2e1ccd
8 changed files with 20 additions and 20 deletions

2
deps/regex vendored

@ -1 +1 @@
Subproject commit 90ef3c4b58140d672ed97cdf45e59592d122368e Subproject commit 8b44176a91326ec0b5e33bc36443ba00cb528c16

2
deps/rust-crypto vendored

@ -1 +1 @@
Subproject commit 6e70e4b98137f247f8d30b698c179d2f973dc23b Subproject commit d06c8672a212add38edfcc5b504e4b4cb30c5a8b

View file

@ -95,8 +95,8 @@ pub fn uumain(args: Vec<String>) -> isize {
set_context(&newroot, &opts); set_context(&newroot, &opts);
unsafe { unsafe {
let executable = CString::from_slice(command[0].as_bytes()).as_slice_with_nul().as_ptr(); let executable = CString::from_slice(command[0].as_bytes()).as_bytes_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 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()); 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 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(); let root_str = root.display();
std::os::change_dir(root).unwrap(); std::os::change_dir(root).unwrap();
let err = unsafe { 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 { if err != 0 {
crash!(1, "cannot chroot to {}: {}", root_str, strerror(err).as_slice()) crash!(1, "cannot chroot to {}: {}", root_str, strerror(err).as_slice())

View file

@ -134,7 +134,7 @@ pub fn get_pw_from_args(free: &Vec<String>) -> Option<c_passwd> {
} else { } else {
let pw_pointer = unsafe { let pw_pointer = unsafe {
let cstr = CString::from_slice(username.as_bytes()); 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() { if !pw_pointer.is_null() {
Some(unsafe { read(pw_pointer) }) Some(unsafe { read(pw_pointer) })
@ -153,7 +153,7 @@ pub fn get_group(groupname: &str) -> Option<c_group> {
} else { } else {
unsafe { unsafe {
let cstr = CString::from_slice(groupname.as_bytes()); 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()) }; let ngroups = unsafe { getgroups(0, null_mut()) };
if ngroups == -1 { if ngroups == -1 {
return Err(os::errno()); return Err(os::errno());

View file

@ -31,7 +31,7 @@ struct EchoOptions {
} }
#[inline(always)] #[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 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 { let (max_digits, is_legal_digit) : (usize, fn(u8) -> bool) = match base {
8us => (3, isodigit), 8 => (3, isodigit),
16us => (2, isxdigit), 16 => (2, isxdigit),
_ => panic!(), _ => panic!(),
}; };
@ -202,7 +202,7 @@ pub fn uumain(args: Vec<String>) -> isize {
't' => print!("\t"), 't' => print!("\t"),
'v' => print!("\x0B"), 'v' => print!("\x0B"),
'x' => { '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 { if num_char_used == 0 {
print!("\\x"); print!("\\x");
} else { } else {
@ -213,7 +213,7 @@ pub fn uumain(args: Vec<String>) -> isize {
} }
}, },
'0' => { '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 { if num_char_used == 0 {
print!("\0"); print!("\0");
} else { } 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 { if num_char_used == 0 {
print!("\\{}", c); print!("\\{}", c);
} else { } else {

View file

@ -243,7 +243,7 @@ fn num_prefix(i: usize, width: usize) -> String {
let div = Int::pow(10 as usize, w); let div = Int::pow(10 as usize, w);
let r = n / div; let r = n / div;
n -= r * div; n -= r * div;
c.push(char::from_digit(r, 10).unwrap()); c.push(char::from_digit(r as u32, 10).unwrap());
} }
c c
} }

View file

@ -20,7 +20,7 @@ use std::old_io::fs::File;
use std::old_path::Path; use std::old_path::Path;
use std::str::from_utf8; use std::str::from_utf8;
use getopts::{optopt, optflag, getopts, usage}; use getopts::{optopt, optflag, getopts, usage};
use std::collections::ring_buf::RingBuf; use std::collections::VecDeque;
use std::old_io::timer::sleep; use std::old_io::timer::sleep;
use std::time::duration::Duration; 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 // 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 // count lines/chars. When reaching the end of file, output the data in the
// ringbuf. // ringbuf.
let mut ringbuf: RingBuf<$kind> = RingBuf::new(); let mut ringbuf: VecDeque<$kind> = VecDeque::new();
let data = $reader.$kindfn().skip( let data = $reader.$kindfn().skip(
if $beginning { if $beginning {
let temp = $count; let temp = $count;

View file

@ -15,7 +15,7 @@ extern crate getopts;
use getopts::OptGroup; use getopts::OptGroup;
use std::char::from_u32; 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::{BufferedReader, print};
use std::old_io::stdio::{stdin_raw, stdout}; use std::old_io::stdio::{stdin_raw, stdout};
use std::iter::FromIterator; use std::iter::FromIterator;
@ -89,7 +89,7 @@ fn expand_set(s: &str) -> Vec<char> {
} }
fn delete(set: Vec<char>, complement: bool) { fn delete(set: Vec<char>, complement: bool) {
let mut bset = BitvSet::new(); let mut bset = BitSet::new();
let mut out = stdout(); let mut out = stdout();
for &c in set.iter() { for &c in set.iter() {