mirror of
https://github.com/uutils/coreutils
synced 2024-07-21 18:04:45 +00:00
refactor/whoami ~ polish spelling (comments, names, and exceptions)
This commit is contained in:
parent
dff33a0edb
commit
5c9b474cc8
|
@ -10,10 +10,10 @@
|
|||
// spell-checker:ignore (ToDO) getusername
|
||||
|
||||
#[cfg(unix)]
|
||||
pub use self::unix::getusername;
|
||||
pub use self::unix::get_username;
|
||||
|
||||
#[cfg(windows)]
|
||||
pub use self::windows::getusername;
|
||||
pub use self::windows::get_username;
|
||||
|
||||
#[cfg(unix)]
|
||||
mod unix;
|
||||
|
|
|
@ -14,7 +14,7 @@ use std::io::Result;
|
|||
use uucore::entries::uid2usr;
|
||||
use uucore::libc::geteuid;
|
||||
|
||||
pub unsafe fn getusername() -> Result<String> {
|
||||
pub unsafe fn get_username() -> Result<String> {
|
||||
// Get effective user id
|
||||
let uid = geteuid();
|
||||
uid2usr(uid)
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
// spell-checker:ignore (ToDO) advapi lmcons winnt getusername WCHAR UNLEN
|
||||
|
||||
extern crate winapi;
|
||||
|
||||
use self::winapi::shared::lmcons;
|
||||
|
@ -18,7 +16,7 @@ use std::io::{Error, Result};
|
|||
use std::mem;
|
||||
use uucore::wide::FromWide;
|
||||
|
||||
pub unsafe fn getusername() -> Result<String> {
|
||||
pub unsafe fn get_username() -> Result<String> {
|
||||
#[allow(deprecated)]
|
||||
let mut buffer: [winnt::WCHAR; lmcons::UNLEN as usize + 1] = mem::uninitialized();
|
||||
let mut len = buffer.len() as minwindef::DWORD;
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
|
||||
/* last synced with: whoami (GNU coreutils) 8.21 */
|
||||
|
||||
// spell-checker:ignore (ToDO) getusername
|
||||
|
||||
#[macro_use]
|
||||
extern crate clap;
|
||||
#[macro_use]
|
||||
|
@ -38,7 +36,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
|
||||
pub fn exec() {
|
||||
unsafe {
|
||||
match platform::getusername() {
|
||||
match platform::get_username() {
|
||||
Ok(username) => println!("{}", username),
|
||||
Err(err) => match err.raw_os_error() {
|
||||
Some(0) | None => crash!(1, "failed to get username"),
|
||||
|
|
Loading…
Reference in a new issue