mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
add uutils multicall binary
This commit is contained in:
@@ -58,6 +58,9 @@ BUILD ?= $(PROGS)
|
||||
EXES := \
|
||||
$(sort $(filter $(BUILD),$(filter-out $(DONT_BUILD),$(PROGS))))
|
||||
|
||||
CRATES := \
|
||||
$(sort $(filter $(EXES), $(filter-out md5sum, $(EXES))))
|
||||
|
||||
# Programs with usable tests
|
||||
TEST_PROGS := \
|
||||
cat \
|
||||
@@ -89,6 +92,11 @@ clean_$(1):
|
||||
endif
|
||||
endef
|
||||
|
||||
define CRATE_BUILD
|
||||
build/$(2): $(1)/$(1).rs
|
||||
$(call command,$(RUSTC) $(RUSTCFLAGS) --crate-type rlib $(1)/$(1).rs --out-dir build)
|
||||
endef
|
||||
|
||||
# Test exe built rules
|
||||
define TEST_BUILD
|
||||
test_$(1): tmp/$(1)_test build build/$(1)
|
||||
@@ -99,7 +107,14 @@ tmp/$(1)_test: $(1)/test.rs
|
||||
endef
|
||||
|
||||
# Main rules
|
||||
ifneq ($(MULTICALL), 1)
|
||||
all: build $(EXES_PATHS)
|
||||
else
|
||||
all: build build/uutils
|
||||
|
||||
build/uutils: uutils/uutils.rs $(addprefix build/, $(foreach crate,$(CRATES),$(shell $(RUSTC) --crate-type rlib --crate-file-name $(crate)/$(crate).rs)))
|
||||
$(RUSTC) $(RUSTCFLAGS) -L build/ uutils/uutils.rs -o $@
|
||||
endif
|
||||
|
||||
test: tmp $(addprefix test_,$(TESTS))
|
||||
$(RM) -rf tmp
|
||||
@@ -117,5 +132,8 @@ tmp:
|
||||
# Creating necessary rules for each targets
|
||||
$(foreach exe,$(EXES),$(eval $(call EXE_BUILD,$(exe))))
|
||||
$(foreach test,$(TESTS),$(eval $(call TEST_BUILD,$(test))))
|
||||
ifeq ($(MULTICALL), 1)
|
||||
$(foreach crate,$(CRATES),$(eval $(call CRATE_BUILD,$(crate),$(shell $(RUSTC) --crate-type rlib --crate-file-name --out-dir build $(crate)/$(crate).rs))))
|
||||
endif
|
||||
|
||||
.PHONY: all test clean
|
||||
|
||||
+5
-2
@@ -35,8 +35,7 @@ mod util;
|
||||
|
||||
static NAME: &'static str = "base64";
|
||||
|
||||
fn main() {
|
||||
let args = os::args();
|
||||
pub fn uumain(args: Vec<String>) {
|
||||
let opts = ~[
|
||||
optflag("d", "decode", "decode data"),
|
||||
optflag("i", "ignore-garbage", "when decoding, ignore non-alphabetic characters"),
|
||||
@@ -91,6 +90,10 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
uumain(os::args());
|
||||
}
|
||||
|
||||
fn decode(input: &mut Reader, ignore_garbage: bool) {
|
||||
let mut to_decode = match input.read_to_str() {
|
||||
Ok(m) => m,
|
||||
|
||||
@@ -23,8 +23,9 @@ mod util;
|
||||
static NAME: &'static str = "basename";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
fn main() {
|
||||
let args = os::args();
|
||||
fn main() { uumain(os::args()); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) {
|
||||
let program = strip_dir(args.get(0).as_slice());
|
||||
|
||||
//
|
||||
|
||||
+3
-2
@@ -19,8 +19,9 @@ use std::io::{print, File};
|
||||
use std::io::stdio::{stdout_raw, stdin_raw};
|
||||
use std::io::{BufferedWriter};
|
||||
|
||||
fn main() {
|
||||
let args = os::args();
|
||||
fn main() { uumain(os::args()); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) {
|
||||
let program = args.get(0).as_slice();
|
||||
let opts = ~[
|
||||
getopts::optflag("A", "show-all", "equivalent to -vET"),
|
||||
|
||||
+3
-2
@@ -77,8 +77,9 @@ fn open_file(name: &str) -> IoResult<Box<Reader>> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let args = os::args();
|
||||
pub fn main() { uumain(os::args()); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) {
|
||||
let opts = [
|
||||
getopts::optflag("h", "help", "display this help and exit"),
|
||||
getopts::optflag("V", "version", "output version information and exit"),
|
||||
|
||||
+3
-2
@@ -87,8 +87,9 @@ fn open_file(name: &str) -> IoResult<Box<Buffer>> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let args = os::args();
|
||||
pub fn main() { uumain(os::args()); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) {
|
||||
let opts = [
|
||||
getopts::optflag("1", "", "suppress column 1 (lines uniq to FILE1)"),
|
||||
getopts::optflag("2", "", "suppress column 2 (lines uniq to FILE2)"),
|
||||
|
||||
@@ -31,8 +31,9 @@ pub enum Mode {
|
||||
Version,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args = os::args();
|
||||
fn main() { uumain(os::args()); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) {
|
||||
let opts = ~[
|
||||
optflag("h", "help", "display this help and exit"),
|
||||
optflag("", "version", "output version information and exit"),
|
||||
|
||||
+3
-2
@@ -16,8 +16,9 @@ use std::io::print;
|
||||
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
fn main() {
|
||||
let args = os::args();
|
||||
fn main() { uumain(os::args()); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) {
|
||||
let program = args.get(0).clone();
|
||||
let opts = ~[
|
||||
getopts::optflag("z", "zero", "separate output with NUL rather than newline"),
|
||||
|
||||
@@ -90,8 +90,9 @@ fn du(path: &Path, mut my_stat: Stat,
|
||||
return stats;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args = os::args();
|
||||
fn main() { uumain(os::args()); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) {
|
||||
let program = args.get(0).as_slice();
|
||||
let opts = ~[
|
||||
// In task
|
||||
|
||||
+3
-2
@@ -69,8 +69,9 @@ fn convert_str(string: &str, index: uint, base: uint) -> (char, int) {
|
||||
return (to_char(&bytes, base), max_digits)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args = os::args();
|
||||
fn main() { uumain(os::args()); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) {
|
||||
let program = args.get(0).clone();
|
||||
let opts = ~[
|
||||
getopts::optflag("n", "", "do not output the trailing newline"),
|
||||
|
||||
Vendored
+5
-2
@@ -13,6 +13,8 @@
|
||||
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
use std::os;
|
||||
|
||||
struct options {
|
||||
ignore_env: bool,
|
||||
null: bool,
|
||||
@@ -51,8 +53,9 @@ fn print_env(null: bool) {
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args = std::os::args();
|
||||
fn main() { uumain(os::args()); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) {
|
||||
let prog = args.get(0).as_slice();
|
||||
|
||||
// to handle arguments the same way than GNU env, we can't use getopts
|
||||
|
||||
+3
-2
@@ -26,9 +26,10 @@ mod util;
|
||||
static NAME: &'static str = "fold";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
fn main() {
|
||||
fn main() { uumain(os::args()); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) {
|
||||
|
||||
let args = os::args();
|
||||
let (args, obs_width) = handle_obsolete(args.as_slice());
|
||||
let program = args.get(0).clone();
|
||||
|
||||
|
||||
+3
-2
@@ -25,8 +25,9 @@ use c_types::{get_pw_from_args, group};
|
||||
|
||||
static NAME: &'static str = "groups";
|
||||
|
||||
fn main () {
|
||||
let args = os::args();
|
||||
fn main () { uumain(os::args()); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) {
|
||||
let options = [
|
||||
optflag("h", "", "Help")
|
||||
];
|
||||
|
||||
+4
-2
@@ -22,11 +22,13 @@ use getopts::{optopt, optflag, getopts, usage};
|
||||
|
||||
static PROGRAM: &'static str = "head";
|
||||
|
||||
fn main () {
|
||||
fn main () { uumain(os::args()); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) {
|
||||
let mut line_count = 10u;
|
||||
|
||||
// handle obsolete -number syntax
|
||||
let options = match obsolete(os::args().tail()) {
|
||||
let options = match obsolete(args.tail()) {
|
||||
(args, Some(n)) => { line_count = n; args },
|
||||
(args, None) => args
|
||||
};
|
||||
|
||||
+3
-2
@@ -49,8 +49,9 @@ extern {
|
||||
pub fn gethostid() -> c_long;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args = os::args();
|
||||
fn main() { uumain(os::args()); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) {
|
||||
|
||||
let opts = [
|
||||
optflag("", "help", "display this help and exit"),
|
||||
|
||||
@@ -23,8 +23,9 @@ extern {
|
||||
fn sethostname(name: *libc::c_char, namelen: libc::c_int) -> libc::c_int;
|
||||
}
|
||||
|
||||
fn main () {
|
||||
let args = os::args();
|
||||
fn main () { uumain(os::args()); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) {
|
||||
let program = args.get(0);
|
||||
|
||||
let options = [
|
||||
|
||||
@@ -87,8 +87,9 @@ extern {
|
||||
|
||||
static NAME: &'static str = "id";
|
||||
|
||||
fn main () {
|
||||
let args = os::args();
|
||||
fn main () { uumain(os::args()); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) {
|
||||
let args_t = args.tail();
|
||||
|
||||
let options = [
|
||||
|
||||
+3
-2
@@ -53,8 +53,9 @@ pub enum Mode {
|
||||
}
|
||||
|
||||
|
||||
fn main() {
|
||||
let args = os::args();
|
||||
fn main() { uumain(os::args()); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) {
|
||||
|
||||
let opts = ~[
|
||||
optflag("h", "help", "display this help and exit"),
|
||||
|
||||
+3
-2
@@ -43,8 +43,9 @@ fn version() {
|
||||
println!("{} {}", NAME, VERSION);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args = os::args();
|
||||
fn main() { uumain(os::args()); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) {
|
||||
let program = args.get(0).clone();
|
||||
|
||||
//
|
||||
|
||||
+3
-2
@@ -28,8 +28,9 @@ static VERSION: &'static str = "1.0.0";
|
||||
/**
|
||||
* Handles option parsing
|
||||
*/
|
||||
fn main() {
|
||||
let args = os::args();
|
||||
fn main() { uumain(os::args()); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) {
|
||||
|
||||
let opts = ~[
|
||||
// Linux-specific options, not implemented
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user