mirror of
https://github.com/uutils/coreutils
synced 2024-12-14 23:32:39 +00:00
Merge pull request #309 from ebfe/build
make: always build multicall binary
This commit is contained in:
commit
cbc21642ab
55 changed files with 69 additions and 251 deletions
|
@ -5,4 +5,3 @@ install:
|
|||
script:
|
||||
- make
|
||||
- make test
|
||||
- make MULTICALL=1
|
||||
|
|
50
Makefile
50
Makefile
|
@ -81,12 +81,12 @@ EXES := \
|
|||
$(sort $(filter $(BUILD),$(filter-out $(DONT_BUILD),$(PROGS))))
|
||||
|
||||
CRATES := \
|
||||
$(sort $(filter $(EXES), $(filter-out true false, $(EXES))))
|
||||
$(sort $(EXES))
|
||||
|
||||
INSTALL ?= $(EXES)
|
||||
|
||||
INSTALLEES := \
|
||||
$(filter $(INSTALL),$(filter-out $(DONT_INSTALL),$(EXES)))
|
||||
$(filter $(INSTALL),$(filter-out $(DONT_INSTALL),$(EXES) uutils))
|
||||
|
||||
# Programs with usable tests
|
||||
TEST_PROGS := \
|
||||
|
@ -109,17 +109,18 @@ command = sh -c '$(1)'
|
|||
|
||||
# Main exe build rule
|
||||
define EXE_BUILD
|
||||
-include build/$(1).d
|
||||
build/gen/$(1).rs: build/mkmain
|
||||
build/mkmain $(1) build/gen/$(1).rs
|
||||
|
||||
build/$(1): $(1)/$(1).rs | build deps
|
||||
$(call command,$(RUSTC) $(RUSTCFLAGS) -L build/ --dep-info build/$(1).d -o build/$(1) $(1)/$(1).rs)
|
||||
build/$(1): build/gen/$(1).rs build/$(1).timestamp | build deps
|
||||
$(RUSTC) $(RUSTCFLAGS) -L build/ -o build/$(1) build/gen/$(1).rs
|
||||
endef
|
||||
|
||||
define CRATE_BUILD
|
||||
-include build/$(1).d
|
||||
|
||||
build/$(2): $(1)/$(1).rs | build deps
|
||||
$(call command,$(RUSTC) $(RUSTCFLAGS) -L build/ --crate-type rlib --dep-info build/$(1).d $(1)/$(1).rs --out-dir build)
|
||||
build/$(1).timestamp: $(1)/$(1).rs | build deps
|
||||
$(RUSTC) $(RUSTCFLAGS) -L build/ --crate-type rlib --dep-info build/$(1).d $(1)/$(1).rs --out-dir build
|
||||
@touch build/$(1).timestamp
|
||||
endef
|
||||
|
||||
# Aliases build rule
|
||||
|
@ -141,16 +142,11 @@ tmp/$(1)_test: $(1)/test.rs
|
|||
endef
|
||||
|
||||
# Main rules
|
||||
ifneq ($(MULTICALL), 1)
|
||||
all: $(EXES_PATHS)
|
||||
else
|
||||
all: build/uutils
|
||||
all: $(EXES_PATHS) build/uutils
|
||||
|
||||
-include build/uutils.d
|
||||
|
||||
build/uutils: uutils/uutils.rs $(addprefix build/, $(foreach crate,$(CRATES),$(shell $(RUSTC) --crate-type rlib --crate-file-name $(crate)/$(crate).rs)))
|
||||
build/uutils: uutils/uutils.rs $(addprefix build/, $(addsuffix .timestamp, $(CRATES)))
|
||||
$(RUSTC) $(RUSTCFLAGS) -L build/ --dep-info $@.d uutils/uutils.rs -o $@
|
||||
endif
|
||||
|
||||
# Dependencies
|
||||
LIBCRYPTO = $(shell $(RUSTC) --crate-file-name --crate-type rlib deps/rust-crypto/src/rust-crypto/lib.rs)
|
||||
|
@ -158,8 +154,14 @@ LIBCRYPTO = $(shell $(RUSTC) --crate-file-name --crate-type rlib deps/rust-crypt
|
|||
build/$(LIBCRYPTO): | build
|
||||
$(RUSTC) $(RUSTCFLAGS) --crate-type rlib --dep-info build/rust-crypto.d deps/rust-crypto/src/rust-crypto/lib.rs --out-dir build/
|
||||
|
||||
build/mkmain: mkmain.rs | build
|
||||
$(RUSTC) $(RUSTCFLAGS) -L build mkmain.rs -o $@
|
||||
|
||||
deps: build/$(LIBCRYPTO)
|
||||
|
||||
crates:
|
||||
echo $(EXES)
|
||||
|
||||
test: tmp $(addprefix test_,$(TESTS))
|
||||
$(RM) -rf tmp
|
||||
|
||||
|
@ -168,28 +170,17 @@ clean:
|
|||
|
||||
build:
|
||||
git submodule update --init
|
||||
mkdir build
|
||||
mkdir -p build/gen
|
||||
|
||||
tmp:
|
||||
mkdir tmp
|
||||
|
||||
# Creating necessary rules for each targets
|
||||
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))))
|
||||
else
|
||||
$(foreach crate,$(CRATES),$(eval $(call CRATE_BUILD,$(crate))))
|
||||
$(foreach exe,$(EXES),$(eval $(call EXE_BUILD,$(exe))))
|
||||
$(foreach alias,$(ALIASES),$(eval $(call MAKE_ALIAS,$(alias))))
|
||||
endif
|
||||
$(foreach test,$(TESTS),$(eval $(call TEST_BUILD,$(test))))
|
||||
|
||||
ifeq ($(MULTICALL), 1)
|
||||
install: build/uutils
|
||||
mkdir -p $(DESTDIR)$(PREFIX)$(BINDIR)
|
||||
install build/uutils $(DESTDIR)$(PREFIX)$(BINDIR)/uutils
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(PREFIX)$(BINDIR)/uutils
|
||||
else
|
||||
install: $(addprefix build/,$(INSTALLEES))
|
||||
mkdir -p $(DESTDIR)$(PREFIX)$(BINDIR)
|
||||
for prog in $(INSTALLEES); do \
|
||||
|
@ -198,10 +189,8 @@ install: $(addprefix build/,$(INSTALLEES))
|
|||
|
||||
uninstall:
|
||||
rm -f $(addprefix $(DESTDIR)$(PREFIX)$(BINDIR)/$(PROG_PREFIX),$(PROGS))
|
||||
endif
|
||||
|
||||
# Test under the busybox testsuite
|
||||
ifeq ($(MULTICALL), 1)
|
||||
build/busybox: build/uutils
|
||||
rm -f build/busybox
|
||||
ln -s $(SRC_DIR)/build/uutils build/busybox
|
||||
|
@ -222,6 +211,5 @@ else
|
|||
busytest: build/busybox build/.config
|
||||
(cd $(BUSYBOX_SRC)/testsuite && bindir=$(SRC_DIR)/build ./runtest $(RUNTEST_ARGS))
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: all deps test clean busytest install uninstall
|
||||
|
|
19
README.md
19
README.md
|
@ -34,11 +34,6 @@ To build only a few of the available utilities:
|
|||
make BUILD='UTILITY_1 UTILITY_2'
|
||||
```
|
||||
|
||||
To build the multicall binary (_i.e._ BusyBox-like binary):
|
||||
```
|
||||
make MULTICALL=1
|
||||
```
|
||||
|
||||
Installation Instructions
|
||||
-------------------------
|
||||
|
||||
|
@ -57,12 +52,7 @@ To install only a few of the available utilities:
|
|||
make INSTALL='UTILITY_1 UTILITY_2' install
|
||||
```
|
||||
|
||||
To install the multicall binary:
|
||||
```
|
||||
make MULTICALL=1 install
|
||||
```
|
||||
|
||||
To install every program (other than the multicall binary) with a prefix:
|
||||
To install every program with a prefix:
|
||||
```
|
||||
make PROG_PREFIX=PREFIX_GOES_HERE install
|
||||
```
|
||||
|
@ -75,12 +65,7 @@ To uninstall all utilities:
|
|||
make uninstall
|
||||
```
|
||||
|
||||
To uninstall the multicall binary:
|
||||
```
|
||||
make MULTICALL=1 uninstall
|
||||
```
|
||||
|
||||
To uninstall every program (other than the multicall binary) with a set prefix:
|
||||
To uninstall every program with a set prefix:
|
||||
```
|
||||
make PROG_PREFIX=PREFIX_GOES_HERE uninstall
|
||||
```
|
||||
|
|
|
@ -18,7 +18,6 @@ extern crate libc;
|
|||
#[phase(plugin, link)] extern crate log;
|
||||
|
||||
use std::io::{println, File, stdin, stdout};
|
||||
use std::os;
|
||||
use std::str;
|
||||
|
||||
use getopts::{
|
||||
|
@ -92,9 +91,6 @@ pub fn uumain(args: Vec<String>) -> int {
|
|||
0
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
fn decode(input: &mut Reader, ignore_garbage: bool) {
|
||||
let mut to_decode = match input.read_to_str() {
|
||||
Ok(m) => m,
|
||||
|
|
|
@ -14,7 +14,6 @@ extern crate getopts;
|
|||
extern crate libc;
|
||||
|
||||
use std::io::{print, println};
|
||||
use std::os;
|
||||
use std::str::StrSlice;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
|
@ -23,9 +22,6 @@ mod util;
|
|||
static NAME: &'static str = "basename";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = strip_dir(args.get(0).as_slice());
|
||||
|
||||
|
|
|
@ -14,15 +14,11 @@
|
|||
|
||||
extern crate getopts;
|
||||
|
||||
use std::os;
|
||||
use std::io::{print, File};
|
||||
use std::io::stdio::{stdout_raw, stdin_raw, stderr};
|
||||
use std::io::{IoResult};
|
||||
use std::ptr::{copy_nonoverlapping_memory};
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0).as_slice();
|
||||
let opts = [
|
||||
|
|
|
@ -36,9 +36,6 @@ extern {
|
|||
static NAME: &'static str = "chroot";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main () { std::os::set_exit_status(uumain(std::os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0);
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ extern crate getopts;
|
|||
|
||||
use std::io::{BufferedReader, EndOfFile, File, IoError, IoResult, print};
|
||||
use std::io::stdio::stdin;
|
||||
use std::os;
|
||||
|
||||
#[path="../common/util.rs"]
|
||||
mod util;
|
||||
|
@ -77,9 +76,6 @@ fn open_file(name: &str) -> IoResult<Box<Reader>> {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let opts = [
|
||||
getopts::optflag("h", "help", "display this help and exit"),
|
||||
|
|
|
@ -15,7 +15,6 @@ use std::cmp::Ord;
|
|||
use std::io::{BufferedReader, IoResult, print};
|
||||
use std::io::fs::File;
|
||||
use std::io::stdio::stdin;
|
||||
use std::os;
|
||||
use std::path::Path;
|
||||
|
||||
static NAME : &'static str = "comm";
|
||||
|
@ -94,9 +93,6 @@ fn open_file(name: &str) -> IoResult<Box<Buffer>> {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let opts = [
|
||||
getopts::optflag("1", "", "suppress column 1 (lines uniq to FILE1)"),
|
||||
|
|
3
cp/cp.rs
3
cp/cp.rs
|
@ -31,9 +31,6 @@ pub enum Mode {
|
|||
Version,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let opts = [
|
||||
optflag("h", "help", "display this help and exit"),
|
||||
|
|
|
@ -11,14 +11,10 @@
|
|||
|
||||
extern crate getopts;
|
||||
|
||||
use std::os;
|
||||
use std::io::print;
|
||||
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0).clone();
|
||||
let opts = [
|
||||
|
|
4
du/du.rs
4
du/du.rs
|
@ -16,7 +16,6 @@ extern crate getopts;
|
|||
extern crate libc;
|
||||
extern crate time;
|
||||
|
||||
use std::os;
|
||||
use std::io::{stderr, fs, FileStat, TypeDirectory};
|
||||
use std::option::Option;
|
||||
use std::path::Path;
|
||||
|
@ -89,9 +88,6 @@ fn du(path: &Path, mut my_stat: Stat,
|
|||
stats
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0).as_slice();
|
||||
let opts = [
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::os;
|
||||
use std::io::{print, println};
|
||||
use std::uint;
|
||||
|
||||
|
@ -163,9 +162,6 @@ fn print_version() {
|
|||
println!("echo version: {:s}", VERSION);
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let mut options = EchoOptions {
|
||||
newline: false,
|
||||
|
|
5
env/env.rs
vendored
5
env/env.rs
vendored
|
@ -13,8 +13,6 @@
|
|||
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
use std::os;
|
||||
|
||||
struct options {
|
||||
ignore_env: bool,
|
||||
null: bool,
|
||||
|
@ -53,9 +51,6 @@ fn print_env(null: bool) {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let prog = args.get(0).as_slice();
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ extern crate getopts;
|
|||
extern crate libc;
|
||||
|
||||
use std::u64;
|
||||
use std::os;
|
||||
use std::vec::{Vec};
|
||||
use std::io::{stdin};
|
||||
|
||||
|
@ -64,9 +63,6 @@ fn print_factors_str(num_str: &str) {
|
|||
print_factors(num);
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0).as_slice();
|
||||
let opts = [
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#![crate_id(name="false", vers="1.0.0", author="Seldaek")]
|
||||
#![crate_id = "uufalse#1.0.0"]
|
||||
|
||||
/*
|
||||
* This file is part of the uutils coreutils package.
|
||||
|
@ -9,6 +9,6 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
fn main() {
|
||||
std::os::set_exit_status(1);
|
||||
pub fn uumain(_: Vec<String>) -> int {
|
||||
1
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ extern crate getopts;
|
|||
|
||||
use std::io::{BufferedReader, BufferedWriter, File, IoResult};
|
||||
use std::io::stdio::{stdin_raw, stdout_raw};
|
||||
use std::os;
|
||||
use linebreak::break_lines;
|
||||
use parasplit::ParagraphStream;
|
||||
|
||||
|
@ -54,9 +53,6 @@ struct FmtOptions {
|
|||
tabwidth : uint,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())) }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
|
||||
let opts = [
|
||||
|
|
|
@ -17,7 +17,6 @@ extern crate libc;
|
|||
use std::io;
|
||||
use std::io::fs::File;
|
||||
use std::io::BufferedReader;
|
||||
use std::os;
|
||||
use std::uint;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
|
@ -26,9 +25,6 @@ mod util;
|
|||
static NAME: &'static str = "fold";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
|
||||
let (args, obs_width) = handle_obsolete(args.as_slice());
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
extern crate getopts;
|
||||
|
||||
use std::os;
|
||||
use getopts::{
|
||||
optflag,
|
||||
getopts,
|
||||
|
@ -26,9 +25,6 @@ use c_types::{get_pw_from_args, group};
|
|||
static NAME: &'static str = "groups";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main () { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0).clone();
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ extern crate getopts;
|
|||
use std::io::fs::File;
|
||||
use std::io::stdio::stdin_raw;
|
||||
use std::io::BufferedReader;
|
||||
use std::os;
|
||||
use regex::Regex;
|
||||
use crypto::digest::Digest;
|
||||
use crypto::md5::Md5;
|
||||
|
@ -88,9 +87,6 @@ fn detect_algo(program: &str, matches: &getopts::Matches) -> (&str, Box<Digest>)
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0).clone();
|
||||
let binary = Path::new(program.as_slice());
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
extern crate getopts;
|
||||
|
||||
use std::os;
|
||||
use std::char;
|
||||
use std::io::{stdin};
|
||||
use std::io::BufferedReader;
|
||||
|
@ -22,9 +21,6 @@ use getopts::{optopt, optflag, getopts, usage};
|
|||
|
||||
static PROGRAM: &'static str = "head";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main () { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let mut line_count = 10u;
|
||||
|
||||
|
|
|
@ -20,8 +20,6 @@ extern crate libc;
|
|||
|
||||
#[phase(plugin, link)] extern crate log;
|
||||
|
||||
use std::os;
|
||||
|
||||
use getopts::{
|
||||
getopts,
|
||||
optflag,
|
||||
|
@ -49,9 +47,6 @@ extern {
|
|||
pub fn gethostid() -> c_long;
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
|
||||
let opts = [
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::{os,str};
|
||||
use std::str;
|
||||
use getopts::{optflag, getopts, usage};
|
||||
|
||||
extern {
|
||||
|
@ -32,9 +32,6 @@ extern {
|
|||
fn sethostname(name: *libc::c_char, namelen: libc::size_t) -> libc::c_int;
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main () { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0);
|
||||
|
||||
|
|
4
id/id.rs
4
id/id.rs
|
@ -18,7 +18,6 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::os;
|
||||
use std::ptr::read;
|
||||
use libc::{
|
||||
uid_t,
|
||||
|
@ -83,9 +82,6 @@ extern {
|
|||
|
||||
static NAME: &'static str = "id";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main () { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let args_t = args.tail();
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ extern crate serialize;
|
|||
|
||||
#[phase(plugin, link)] extern crate log;
|
||||
|
||||
use std::os;
|
||||
use std::from_str::from_str;
|
||||
use std::io::process::Process;
|
||||
|
||||
|
@ -52,9 +51,6 @@ pub enum Mode {
|
|||
Version,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
|
||||
let opts = [
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
extern crate getopts;
|
||||
|
||||
use std::io::fs::link;
|
||||
use std::os;
|
||||
use std::path::Path;
|
||||
|
||||
#[path="../common/util.rs"]
|
||||
|
@ -22,9 +21,6 @@ mod util;
|
|||
static NAME : &'static str = "link";
|
||||
static VERSION : &'static str = "1.0.0";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let opts = [
|
||||
getopts::optflag("h", "help", "display this help and exit"),
|
||||
|
|
|
@ -19,7 +19,6 @@ extern crate getopts;
|
|||
extern crate libc;
|
||||
|
||||
use std::io::print;
|
||||
use std::os;
|
||||
use std::str;
|
||||
use libc::c_char;
|
||||
|
||||
|
@ -43,9 +42,6 @@ fn version() {
|
|||
println!("{} {}", NAME, VERSION);
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0).clone();
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::os;
|
||||
use std::io::fs;
|
||||
use std::io::FilePermission;
|
||||
use std::num::strconv;
|
||||
|
@ -28,9 +27,6 @@ static VERSION: &'static str = "1.0.0";
|
|||
/**
|
||||
* Handles option parsing
|
||||
*/
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
|
||||
let opts = [
|
||||
|
|
|
@ -23,9 +23,6 @@ mod util;
|
|||
static NAME : &'static str = "mkfifo";
|
||||
static VERSION : &'static str = "1.0.0";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let opts = [
|
||||
getopts::optopt("m", "mode", "file permissions for the fifo", "(default 0666)"),
|
||||
|
|
40
mkmain.rs
Normal file
40
mkmain.rs
Normal file
|
@ -0,0 +1,40 @@
|
|||
use std::io::{File, Truncate, ReadWrite};
|
||||
use std::os;
|
||||
use std::path::Path;
|
||||
use std::str::replace;
|
||||
|
||||
static TEMPLATE : &'static str = r"
|
||||
extern crate @UTIL_CRATE@;
|
||||
|
||||
use std::os;
|
||||
use @UTIL_CRATE@::uumain;
|
||||
|
||||
fn main() {
|
||||
os::set_exit_status(uumain(os::args()));
|
||||
}
|
||||
";
|
||||
|
||||
fn main() {
|
||||
let args = os::args();
|
||||
if args.len() != 3 {
|
||||
println!("usage: mkbuild <crate> <outfile>");
|
||||
os::set_exit_status(1);
|
||||
return;
|
||||
}
|
||||
|
||||
let crat = match args.get(1).as_slice() {
|
||||
"true" => "uutrue",
|
||||
"false" => "uufalse",
|
||||
"sync" => "uusync",
|
||||
s => s.clone(),
|
||||
};
|
||||
let outfile = args.get(2).as_slice();
|
||||
|
||||
let main = std::str::replace(TEMPLATE, "@UTIL_CRATE@", crat);
|
||||
let mut out = File::open_mode(&Path::new(outfile), Truncate, ReadWrite);
|
||||
|
||||
match out.write(main.as_bytes()) {
|
||||
Err(e) => fail!("{}", e),
|
||||
_ => (),
|
||||
}
|
||||
}
|
6
nl/nl.rs
6
nl/nl.rs
|
@ -16,7 +16,6 @@ extern crate regex_macros;
|
|||
extern crate regex;
|
||||
extern crate getopts;
|
||||
|
||||
use std::os;
|
||||
use std::io::{stdin};
|
||||
use std::io::BufferedReader;
|
||||
use std::io::fs::File;
|
||||
|
@ -75,11 +74,6 @@ enum NumberFormat {
|
|||
RightZero,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main () {
|
||||
os::set_exit_status(uumain(os::args()));
|
||||
}
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let possible_options = [
|
||||
optopt("b", "body-numbering", "use STYLE for numbering body lines", "STYLE"),
|
||||
|
|
|
@ -15,7 +15,6 @@ extern crate getopts;
|
|||
extern crate libc;
|
||||
|
||||
use std::io;
|
||||
use std::os;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
mod util;
|
||||
|
@ -23,9 +22,6 @@ mod util;
|
|||
static NAME: &'static str = "paste";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0).clone();
|
||||
|
||||
|
|
|
@ -24,9 +24,6 @@ mod util;
|
|||
|
||||
static NAME: &'static str = "printenv";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0).clone();
|
||||
let opts = [
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::os;
|
||||
use std::io::print;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
|
@ -23,9 +22,6 @@ mod util;
|
|||
static NAME: &'static str = "pwd";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0).clone();
|
||||
let opts = [
|
||||
|
|
4
rm/rm.rs
4
rm/rm.rs
|
@ -14,7 +14,6 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::os;
|
||||
use std::io::{print, stdin, stdio, fs, BufferedReader};
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
|
@ -29,9 +28,6 @@ enum InteractiveMode {
|
|||
|
||||
static NAME: &'static str = "rm";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0).clone();
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::os;
|
||||
use std::io::{print, fs};
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
|
@ -22,9 +21,6 @@ mod util;
|
|||
|
||||
static NAME: &'static str = "rmdir";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0).clone();
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ extern crate libc;
|
|||
|
||||
use std::cmp;
|
||||
use std::io;
|
||||
use std::os;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
mod util;
|
||||
|
@ -159,9 +158,6 @@ fn print_version() {
|
|||
println!("seq 1.0.0\n");
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0).clone();
|
||||
let mut options = SeqOptions {
|
||||
|
|
|
@ -15,7 +15,6 @@ extern crate getopts;
|
|||
extern crate libc;
|
||||
|
||||
use std::f64;
|
||||
use std::os;
|
||||
use std::io::{print, timer};
|
||||
use std::u64;
|
||||
|
||||
|
@ -24,9 +23,6 @@ mod util;
|
|||
|
||||
static NAME: &'static str = "sleep";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0).clone();
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::os;
|
||||
use std::io::{File, IoResult, print};
|
||||
use std::io::stdio::{stdin_raw};
|
||||
|
||||
|
@ -76,9 +75,6 @@ fn open(name: &str) -> IoResult<Box<Reader>> {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0).as_slice();
|
||||
let opts = [
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::os;
|
||||
use getopts::{optflag, getopts, usage};
|
||||
|
||||
#[path = "../common/util.rs"] mod util;
|
||||
|
@ -136,11 +135,6 @@ mod platform {
|
|||
}
|
||||
}
|
||||
|
||||
static NAME: &'static str = "sync";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main () { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0);
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ extern crate getopts;
|
|||
extern crate libc;
|
||||
|
||||
use std::io;
|
||||
use std::os;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
mod util;
|
||||
|
@ -23,9 +22,6 @@ mod util;
|
|||
static NAME: &'static str = "tac";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0).clone();
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
extern crate getopts;
|
||||
|
||||
use std::os;
|
||||
use std::char;
|
||||
use std::io::{stdin};
|
||||
use std::io::BufferedReader;
|
||||
|
@ -24,9 +23,6 @@ use std::io::timer::sleep;
|
|||
|
||||
static PROGRAM: &'static str = "tail";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let mut line_count = 10u;
|
||||
let mut sleep_sec = 1000u64;
|
||||
|
|
|
@ -24,9 +24,6 @@ use getopts::{getopts, optflag, usage};
|
|||
static NAME: &'static str = "tee";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
match options(args.as_slice()).and_then(exec) {
|
||||
Ok(_) => 0,
|
||||
|
|
|
@ -14,7 +14,6 @@ extern crate getopts;
|
|||
extern crate time;
|
||||
|
||||
use std::io::File;
|
||||
use std::os;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
mod util;
|
||||
|
@ -22,9 +21,6 @@ mod util;
|
|||
static NAME: &'static str = "touch";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let opts = [
|
||||
getopts::optflag("a", "", "change only the access time"),
|
||||
|
|
4
tr/tr.rs
4
tr/tr.rs
|
@ -20,7 +20,6 @@ use std::char::from_u32;
|
|||
use std::io::print;
|
||||
use std::io::stdio::{stdin,stdout};
|
||||
use std::iter::FromIterator;
|
||||
use std::os;
|
||||
use std::vec::Vec;
|
||||
|
||||
#[path="../common/util.rs"]
|
||||
|
@ -146,9 +145,6 @@ fn usage(opts: &[OptGroup]) {
|
|||
print(getopts::usage("Translate or delete characters.", opts).as_slice());
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let opts = [
|
||||
getopts::optflag("c", "complement", "use the complement of SET1"),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#![crate_id(name="true", vers="1.0.0", author="Seldaek")]
|
||||
#![crate_id = "uutrue#1.0.0"]
|
||||
|
||||
/*
|
||||
* This file is part of the uutils coreutils package.
|
||||
|
@ -9,5 +9,6 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
fn main() {
|
||||
pub fn uumain(_: Vec<String>) -> int {
|
||||
0
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ extern crate getopts;
|
|||
extern crate libc;
|
||||
|
||||
use std::io::{File, Open, ReadWrite, fs};
|
||||
use std::os;
|
||||
use std::u64;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
|
@ -34,9 +33,6 @@ enum TruncateMode {
|
|||
|
||||
static NAME: &'static str = "truncate";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0).clone();
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::{str,os};
|
||||
use std::str;
|
||||
use std::io::println;
|
||||
use std::io::stdio::stderr;
|
||||
use getopts::{optflag,getopts};
|
||||
|
@ -34,9 +34,6 @@ extern {
|
|||
|
||||
static NAME: &'static str = "tty";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main () { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let options = [
|
||||
optflag("s", "silent", "print nothing, only return an exit status")
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::os;
|
||||
use std::mem::uninitialized;
|
||||
use std::io::print;
|
||||
use std::str::raw::from_c_str;
|
||||
|
@ -51,9 +50,6 @@ unsafe fn getuname() -> utsrust {
|
|||
|
||||
static NAME: &'static str = "uname";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0).as_slice();
|
||||
let opts = [
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::os;
|
||||
use std::io;
|
||||
use std::io::fs;
|
||||
use std::io::print;
|
||||
|
@ -26,9 +25,6 @@ mod util;
|
|||
|
||||
static NAME: &'static str = "unlink";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0).clone();
|
||||
let opts = [
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::os;
|
||||
use std::mem::transmute;
|
||||
use std::io::{print, File};
|
||||
use std::ptr::null;
|
||||
|
@ -47,9 +46,6 @@ extern {
|
|||
fn utmpxname(file: *c_char) -> c_int;
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0).clone();
|
||||
let opts = [
|
||||
|
|
|
@ -21,7 +21,6 @@ extern crate libc;
|
|||
|
||||
use std::io::print;
|
||||
use std::mem;
|
||||
use std::os;
|
||||
use std::ptr;
|
||||
use std::str;
|
||||
use utmpx::*;
|
||||
|
@ -47,9 +46,6 @@ extern {
|
|||
|
||||
static NAME: &'static str = "users";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0).as_slice();
|
||||
let opts = [
|
||||
|
|
4
wc/wc.rs
4
wc/wc.rs
|
@ -14,7 +14,6 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::os;
|
||||
use std::str::from_utf8;
|
||||
use std::io::{print, stdin, File, BufferedReader};
|
||||
use StdResult = std::result::Result;
|
||||
|
@ -34,9 +33,6 @@ struct Result {
|
|||
|
||||
static NAME: &'static str = "wc";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0).clone();
|
||||
let opts = [
|
||||
|
|
|
@ -19,7 +19,6 @@ extern crate getopts;
|
|||
extern crate libc;
|
||||
|
||||
use std::io::print;
|
||||
use std::os;
|
||||
|
||||
#[path = "../common/util.rs"] mod util;
|
||||
|
||||
|
@ -67,9 +66,6 @@ mod platform {
|
|||
|
||||
static NAME: &'static str = "whoami";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0).as_slice();
|
||||
let opts = [
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::os;
|
||||
use std::io::{print, println};
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
|
@ -24,9 +23,6 @@ mod util;
|
|||
|
||||
static NAME: &'static str = "yes";
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let program = args.get(0).clone();
|
||||
let opts = [
|
||||
|
|
Loading…
Reference in a new issue