refactor/whoami ~ polish spelling (comments, names, and exceptions)

This commit is contained in:
Roy Ivy III 2021-05-29 22:24:30 -05:00
parent dff33a0edb
commit 5c9b474cc8
4 changed files with 5 additions and 9 deletions

View file

@ -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;

View file

@ -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)

View file

@ -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;

View file

@ -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"),