dmrconfig/src/lib.rs

49 lines
1.6 KiB
Rust

use std::ffi::CStr;
use libc::c_char;
const COPYRIGHT: &'static str = "Copyright (C) 2018 Serge Vakulenko KK6ABQ";
#[no_mangle]
pub extern "C" fn print_usage(version_ptr: *const c_char) {
let version: String = unsafe { CStr::from_ptr(version_ptr) }.to_string_lossy().to_string();
print!("DMR Config, Version {}, {}", version, COPYRIGHT);
let msg = r#"
Usage:
dmrconfig -r [-t]\n
Read codeplug from the radio to a file 'device.img'.
Save configuration to a text file 'device.conf'.
dmrconfig -w [-t] file.img
Write codeplug to the radio.
dmrconfig -v [-t] file.conf
Verify configuration script for the radio.
dmrconfig -c [-t] file.conf
Apply configuration script to the radio.
dmrconfig -c file.img file.conf
Apply configuration script to the codeplug image.
Store modified copy to a file 'device.img'.
dmrconfig file.img
Display configuration from the codeplug image.
dmrconfig -u [-t] file.csv
Update contacts database from CSV file.
Options:
-r Read codeplug from the radio.
-w Write codeplug to the radio.
-c Configure the radio from a text script.
-v Verify config file.
-u Update contacts database.
-l List all supported radios.
-t Trace USB protocol."#;
print!("{}", msg);
std::process::exit(-1);
}
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}