From: Ian Jackson Date: Sat, 8 Aug 2020 17:54:51 +0000 (+0100) Subject: exit_usage X-Git-Tag: otter-0.2.0~1161 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=05ffc4a8950eda2d735031dcc41ce0154a9cdac8;p=otter.git exit_usage --- diff --git a/src/bin/otter.rs b/src/bin/otter.rs index 0eacd702..3ddcddb4 100644 --- a/src/bin/otter.rs +++ b/src/bin/otter.rs @@ -85,6 +85,8 @@ impl<'x, T, F: FnMut(&str) -> Result> } } +const EXIT_USAGE : i32 = 12; + #[derive(Debug,Default)] struct MainOpts { scope: Option, @@ -137,12 +139,12 @@ fn main() { // want to call ap.error but we have to drop it because // otherwise it still has mainopts.scope borrowed eprintln!("bad usage: --scope-unix needs USER env var: {}", &e); - exit(12); + exit(EXIT_USAGE); }); ManagementScope::Unix { user } }); >::Ok((mainopts, subcommand, subargs)) - })().unwrap_or_else(|rc| exit(if rc!=0 { 12 } else { 0 })); + })().unwrap_or_else(|rc| exit(if rc!=0 { EXIT_USAGE } else { 0 })); for _ in inventory::iter:: { } @@ -151,7 +153,7 @@ fn main() { .next() .unwrap_or_else(||{ eprintln!("subcommand `{}' not recognised", &pa.1); - exit(12); + exit(EXIT_USAGE); }); call(pa.0, &pa.2);