aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2017-12-04 23:58:25 -0800
committerbnewbold <bnewbold@robocracy.org>2017-12-04 23:58:25 -0800
commit36e6ca2f24e41a10e4f168e99fed3bbfdd4d5ed0 (patch)
treedcf61d4e22dc75eab47e25d51c06f2e323f11005
parent58ad2b667811bbf459199828410ece86ed59e11e (diff)
downloaducp-old-patches.tar.gz
ucp-old-patches.zip
old un-commited codeold-patches
-rw-r--r--TODO1
-rw-r--r--src/main.rs25
2 files changed, 23 insertions, 3 deletions
diff --git a/TODO b/TODO
index f23f74a..0907518 100644
--- a/TODO
+++ b/TODO
@@ -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!("");