sleep(1): reduce dependence on sysexits
This commit is contained in:
parent
82f6c46b64
commit
b06c1d5488
@ -24,7 +24,7 @@ use std::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern crate sysexits;
|
extern crate sysexits;
|
||||||
use sysexits::{EX_OK, EX_USAGE};
|
use sysexits::EX_USAGE;
|
||||||
|
|
||||||
fn usage(s: &str) -> ExitCode {
|
fn usage(s: &str) -> ExitCode {
|
||||||
eprintln!("Usage: {} [seconds]", s);
|
eprintln!("Usage: {} [seconds]", s);
|
||||||
@ -37,7 +37,7 @@ fn main() -> ExitCode {
|
|||||||
if argv.len() == 2 {
|
if argv.len() == 2 {
|
||||||
if let Ok(s) = argv[1].parse::<u64>() {
|
if let Ok(s) = argv[1].parse::<u64>() {
|
||||||
sleep(Duration::from_secs(s));
|
sleep(Duration::from_secs(s));
|
||||||
ExitCode::from(EX_OK as u8)
|
ExitCode::SUCCESS
|
||||||
} else {
|
} else {
|
||||||
usage(&argv[0])
|
usage(&argv[0])
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user