mirror of
https://github.com/uutils/coreutils
synced 2024-11-15 17:28:03 +00:00
7d1d307b92
With the 1.0 release, unstable features are causing build errors. I replaced references to std::env::set_exit_status() with std::process::exit().
39 lines
889 B
Rust
39 lines
889 B
Rust
use std::env;
|
|
use std::io::Write;
|
|
use std::fs::File;
|
|
|
|
static TEMPLATE: &'static str = "\
|
|
extern crate @UTIL_CRATE@ as uu@UTIL_CRATE@;
|
|
|
|
use std::env;
|
|
use uu@UTIL_CRATE@::uumain;
|
|
|
|
fn main() {
|
|
std::process::exit(uumain(env::args().collect()));
|
|
}
|
|
";
|
|
|
|
fn main() {
|
|
let args : Vec<String> = env::args().collect();
|
|
if args.len() != 3 {
|
|
println!("usage: mkbuild <crate> <outfile>");
|
|
std::process::exit(1);
|
|
}
|
|
|
|
let crat = match &args[1][..] {
|
|
"false" => "uufalse",
|
|
"test" => "uutest",
|
|
"true" => "uutrue",
|
|
_ => &args[1][..],
|
|
};
|
|
let outfile = &args[2][..];
|
|
|
|
let main = TEMPLATE.replace("@UTIL_CRATE@", crat);
|
|
match File::create(outfile) {
|
|
Ok(mut out) => match out.write_all(main.as_bytes()) {
|
|
Err(e) => panic!("{}", e),
|
|
_ => (),
|
|
},
|
|
Err(e) => panic!("{}", e),
|
|
}
|
|
}
|