implem_command #9
1 changed files with 44 additions and 44 deletions
|
@ -6,12 +6,12 @@ use crate::status_obj;
|
|||
pub fn sent_signal( svwait_var: i32, verbose: i8, command: &str, mut sv: status_obj::StatusObj) -> i32 {
|
||||
// Return 0 in case everything worked fine, return 1 if timeout or error.
|
||||
|
||||
if command == "s" {
|
||||
match command {
|
||||
"s" => {
|
||||
// case command is status
|
||||
return misc::print_status(sv);
|
||||
}
|
||||
|
||||
if command == "u" {
|
||||
},
|
||||
"u" => {
|
||||
// case where command is up
|
||||
if sv.sent_signal(b"u") {
|
||||
if verbose == 1 {
|
||||
|
@ -22,9 +22,8 @@ pub fn sent_signal( svwait_var: i32, verbose: i8, command: &str, mut sv: status_
|
|||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if command == "d" {
|
||||
},
|
||||
"d" => {
|
||||
// case where command is up
|
||||
if sv.sent_signal(b"d") {
|
||||
if verbose == 1 {
|
||||
|
@ -35,9 +34,8 @@ pub fn sent_signal( svwait_var: i32, verbose: i8, command: &str, mut sv: status_
|
|||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if command == "o" {
|
||||
},
|
||||
"o" => {
|
||||
// case where command is run once.
|
||||
if sv.sent_signal(b"o") {
|
||||
if verbose == 1 {
|
||||
|
@ -48,12 +46,14 @@ pub fn sent_signal( svwait_var: i32, verbose: i8, command: &str, mut sv: status_
|
|||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
println!("Error, command not implemented.");
|
||||
},
|
||||
other => {
|
||||
println!("Error, command {} not implemented.", other); // TODO : Put the real error
|
||||
// message.
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue