diff options
| -rw-r--r-- | TODO | 1 | ||||
| -rw-r--r-- | src/main.rs | 25 | 
2 files changed, 23 insertions, 3 deletions
| @@ -1,4 +1,5 @@ +- check on https://sourceforge.net/projects/tsunami-udp/  - note in README: IPv4 only  bugs: diff --git a/src/main.rs b/src/main.rs index 08cd67e..141c1a2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,9 @@  // XXX: re-enable these warnings  #![allow(unused_imports, unused_variables, unused_mut)] -#[macro_use] extern crate log; +#[macro_use] +extern crate log; +  extern crate env_logger;  extern crate getopts;  extern crate udt; @@ -21,9 +23,10 @@ use std::process::exit;  use getopts::Options;  use udt::{UdtSocket}; +  fn usage(opts: Options) {      let brief = "usage:\tucp [-h] [-v] [[user@]host1:]srcfile [[user@]host2:]destfile"; -    print!("{}", opts.usage(&brief)); +    print!("{}", opts.usage(brief));  }  fn main() { @@ -43,14 +46,25 @@ fn main() {      let mut opts = Options::new();      opts.optflag("h", "help", "print this help menu");      opts.optflag("v", "verbose", "more debugging messages"); +    opts.optflag("V", "version", "show version info");      opts.optflag("r", "recursive", "whether to recursively transfer files (directory)");      opts.optflag("", "no-crypto", "sends data in the clear (no crypto or verification)"); -    let matches = match opts.parse(&args[1..]) { + +    let r = opts.parse(&args[1..]); + +    println!("{}", r); + +    let matches = match r {          Ok(m) => { m }          Err(f) => { println!("{}", f.to_string()); usage(opts); exit(-1); }      }; +    match opts.parse(&args[1..]) { +        Ok(m) => { println!("got something!"); } +        Err(f) => { println!("{}", f.to_string()); usage(opts); exit(-1); } +    }; +      let verbose: bool = matches.opt_present("v");      let recursive: bool = matches.opt_present("r");      let no_crypto: bool = matches.opt_present("no-crypto"); @@ -60,6 +74,11 @@ fn main() {          return;      } +    if matches.opt_present("V") { +        println!("ucp version: {}", env!("CARGO_PKG_VERSION")); +        return; +    } +      if matches.free.len() != 2 {          println!("Expected a single source and single destination");          println!(""); | 
