mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-05 15:37:47 +00:00
Merge pull request #2803 from jfinkels/logname-uresult
logname: return UResult from uumain() function
This commit is contained in:
commit
b81fb167e2
1 changed files with 6 additions and 5 deletions
|
@ -12,10 +12,10 @@
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate uucore;
|
extern crate uucore;
|
||||||
|
|
||||||
use std::ffi::CStr;
|
|
||||||
use uucore::InvalidEncodingHandling;
|
|
||||||
|
|
||||||
use clap::{crate_version, App};
|
use clap::{crate_version, App};
|
||||||
|
use std::ffi::CStr;
|
||||||
|
use uucore::error::UResult;
|
||||||
|
use uucore::InvalidEncodingHandling;
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
// POSIX requires using getlogin (or equivalent code)
|
// POSIX requires using getlogin (or equivalent code)
|
||||||
|
@ -39,7 +39,8 @@ fn usage() -> &'static str {
|
||||||
uucore::execution_phrase()
|
uucore::execution_phrase()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
#[uucore_procs::gen_uumain]
|
||||||
|
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
let args = args
|
let args = args
|
||||||
.collect_str(InvalidEncodingHandling::Ignore)
|
.collect_str(InvalidEncodingHandling::Ignore)
|
||||||
.accept_any();
|
.accept_any();
|
||||||
|
@ -51,7 +52,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||||
None => show_error!("no login name"),
|
None => show_error!("no login name"),
|
||||||
}
|
}
|
||||||
|
|
||||||
0
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn uu_app() -> App<'static, 'static> {
|
pub fn uu_app() -> App<'static, 'static> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue