aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs2
-rw-r--r--src/tftpc.rs3
-rw-r--r--src/tftpd.rs3
3 files changed, 6 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 7e0051a..659e2df 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -11,6 +11,8 @@ use std::net::{SocketAddr, UdpSocket};
use std::path::{Path, PathBuf};
use std::time::Duration;
+pub static VERSION: Option<&str> = option_env!("CARGO_PKG_VERSION");
+
#[repr(u16)]
pub enum Opcodes {
RRQ = 0x01,
diff --git a/src/tftpc.rs b/src/tftpc.rs
index 689d055..adac705 100644
--- a/src/tftpc.rs
+++ b/src/tftpc.rs
@@ -249,7 +249,8 @@ fn usage(opts: Options, program: String, error: Option<String>) {
if let Some(err) = error {
println!("{}\n", err);
}
- println!("{}", opts.usage(format!("RusTFTP\n\n{} [options] <remote>[:port]", program).as_str()));
+ let version = rtftp::VERSION.unwrap_or("");
+ println!("{}", opts.usage(format!("RusTFTP {}\n\n{} [options] <remote>[:port]", version, program).as_str()));
}
fn parse_commandline(args: &[String]) -> Result<Configuration, &str> {
diff --git a/src/tftpd.rs b/src/tftpd.rs
index 48e7a40..c8bd5b5 100644
--- a/src/tftpd.rs
+++ b/src/tftpd.rs
@@ -282,7 +282,8 @@ fn usage(opts: Options, program: String, error: Option<String>) {
if let Some(err) = error {
println!("{}\n", err);
}
- println!("{}", opts.usage(format!("RusTFTP\n\n{} [options]", program).as_str()));
+ let version = rtftp::VERSION.unwrap_or("");
+ println!("{}", opts.usage(format!("RusTFTP {}\n\n{} [options]", version, program).as_str()));
}
fn parse_commandline(args: &[String]) -> Result<Configuration, &str> {