mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-01 05:27:45 +00:00
Allow test to be checked by the Busybox test suite
This commit is contained in:
parent
afabebe432
commit
ba0177c824
1 changed files with 12 additions and 4 deletions
|
@ -16,13 +16,21 @@ use std::os::{args_as_bytes};
|
||||||
use std::str::{from_utf8};
|
use std::str::{from_utf8};
|
||||||
use num::bigint::{BigInt};
|
use num::bigint::{BigInt};
|
||||||
|
|
||||||
|
static NAME: &'static str = "test";
|
||||||
|
|
||||||
|
// TODO: decide how to handle non-UTF8 input for all the utils
|
||||||
pub fn uumain(_: Vec<String>) -> int {
|
pub fn uumain(_: Vec<String>) -> int {
|
||||||
let args = args_as_bytes();
|
let args = args_as_bytes();
|
||||||
let args: Vec<&[u8]> = args.iter().map(|a| a.as_slice()).collect();
|
let args: Vec<&[u8]> = args.iter().map(|a| a.as_slice()).collect();
|
||||||
let args = args.as_slice();
|
|
||||||
if args.len() == 0 {
|
if args.len() == 0 {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
let args =
|
||||||
|
if !args[0].ends_with(NAME.as_bytes()) {
|
||||||
|
args.slice_from(1)
|
||||||
|
} else {
|
||||||
|
args.as_slice()
|
||||||
|
};
|
||||||
let args = match args[0] {
|
let args = match args[0] {
|
||||||
b"[" => match args[args.len() - 1] {
|
b"[" => match args[args.len() - 1] {
|
||||||
b"]" => args.slice(1, args.len() - 1),
|
b"]" => args.slice(1, args.len() - 1),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue