mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-20 13:34:00 +08:00
fix some trivial style problems
This commit is contained in:
parent
a5a9ca7d3b
commit
d00ab4a326
10
src/env.cpp
10
src/env.cpp
|
@ -702,11 +702,11 @@ wcstring env_get_pwd_slash(void) {
|
|||
/// Set up the USER variable.
|
||||
static void setup_user(bool force) {
|
||||
if (env_get_string(L"USER").missing_or_empty() || force) {
|
||||
struct passwd userinfo;
|
||||
struct passwd *result;
|
||||
char buf[8192];
|
||||
int retval = getpwuid_r(getuid(), &userinfo, buf, sizeof(buf), &result);
|
||||
if (!retval && result) {
|
||||
struct passwd userinfo;
|
||||
struct passwd *result;
|
||||
char buf[8192];
|
||||
int retval = getpwuid_r(getuid(), &userinfo, buf, sizeof(buf), &result);
|
||||
if (!retval && result) {
|
||||
const wcstring uname = str2wcstring(userinfo.pw_name);
|
||||
env_set(L"USER", uname.c_str(), ENV_GLOBAL | ENV_EXPORT);
|
||||
}
|
||||
|
|
|
@ -92,9 +92,7 @@ static char *sequence_name(wchar_t wc) {
|
|||
|
||||
/// Return true if the character must be escaped when used in the sequence of chars to be bound in
|
||||
/// a `bind` command.
|
||||
static bool must_escape(wchar_t wc) {
|
||||
return wcschr(L"[]()<>{}*\\?$#;&|'\"", wc) != NULL;
|
||||
}
|
||||
static bool must_escape(wchar_t wc) { return wcschr(L"[]()<>{}*\\?$#;&|'\"", wc) != NULL; }
|
||||
|
||||
static void ctrl_to_symbol(wchar_t *buf, int buf_len, wchar_t wc, bool bind_friendly) {
|
||||
if (ctrl_symbolic_names[wc]) {
|
||||
|
|
|
@ -1517,9 +1517,9 @@ static bool check_for_orphaned_process(unsigned long loop_count, pid_t shell_pgi
|
|||
we_think_we_are_orphaned = true;
|
||||
}
|
||||
|
||||
// Try reading from the tty; if we get EIO we are orphaned. This is sort of bad because it
|
||||
// may block.
|
||||
if (!we_think_we_are_orphaned && loop_count % 128 == 0) {
|
||||
// Try reading from the tty; if we get EIO we are orphaned. This is sort of bad because it
|
||||
// may block.
|
||||
#ifdef HAVE_CTERMID_R
|
||||
char buf[L_ctermid];
|
||||
char *tty = ctermid_r(buf);
|
||||
|
|
Loading…
Reference in New Issue
Block a user