mirror of
https://github.com/uutils/coreutils
synced 2024-11-15 01:17:09 +00:00
Rearrange functions in tee
This commit is contained in:
parent
af4092124b
commit
7e260558b8
1 changed files with 9 additions and 9 deletions
18
tee/tee.rs
18
tee/tee.rs
|
@ -70,15 +70,6 @@ fn options(args: &[~str]) -> Result<Options, ~str> {
|
|||
})
|
||||
}
|
||||
|
||||
fn open(path: &Path, append: bool) -> ~Writer {
|
||||
if *path == Path::new("-") {
|
||||
~stdout() as ~Writer
|
||||
} else {
|
||||
let mode = if append { Append } else { Truncate };
|
||||
~File::open_mode(path, mode, Write) as ~Writer
|
||||
}
|
||||
}
|
||||
|
||||
fn exec(options: Options) -> Result<int, ~str> {
|
||||
match options.print_and_exit {
|
||||
Some(text) => {
|
||||
|
@ -108,6 +99,15 @@ fn tee(options: Options) -> Result<int, ~str> {
|
|||
})).map_err(|err| err.desc.to_owned())
|
||||
}
|
||||
|
||||
fn open(path: &Path, append: bool) -> ~Writer {
|
||||
if *path == Path::new("-") {
|
||||
~stdout() as ~Writer
|
||||
} else {
|
||||
let mode = if append { Append } else { Truncate };
|
||||
~File::open_mode(path, mode, Write) as ~Writer
|
||||
}
|
||||
}
|
||||
|
||||
fn warn(message: &str) {
|
||||
error!("{}: {}", args()[0], message);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue