From 88aee30ae8bc969e73c9c59b29e7866b2f7b1b5e Mon Sep 17 00:00:00 2001
From: Sorin Ionescu <sorin.ionescu@gmail.com>
Date: Fri, 13 Feb 2015 00:00:27 -0500
Subject: [PATCH] [Fix #762] Use $LOGNAME instead of $USER

$USER is deprecated.
---
 modules/completion/init.zsh | 2 +-
 modules/gpg/init.zsh        | 2 +-
 modules/ssh/init.zsh        | 2 +-
 modules/utility/init.zsh    | 2 +-
 runcoms/zprofile            | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/completion/init.zsh b/modules/completion/init.zsh
index 28c2090..9b5132c 100644
--- a/modules/completion/init.zsh
+++ b/modules/completion/init.zsh
@@ -116,7 +116,7 @@ zstyle ':completion:*:(rm|kill|diff):*' ignore-line other
 zstyle ':completion:*:rm:*' file-patterns '*:all-files'
 
 # Kill
-zstyle ':completion:*:*:*:*:processes' command 'ps -u $USER -o pid,user,command -w'
+zstyle ':completion:*:*:*:*:processes' command 'ps -u $LOGNAME -o pid,user,command -w'
 zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;36=0=01'
 zstyle ':completion:*:*:kill:*' menu yes select
 zstyle ':completion:*:*:kill:*' force-list always
diff --git a/modules/gpg/init.zsh b/modules/gpg/init.zsh
index 1c3837d..a7c6cf7 100644
--- a/modules/gpg/init.zsh
+++ b/modules/gpg/init.zsh
@@ -20,7 +20,7 @@ if [[ -z "$GPG_AGENT_INFO" && ! -S "${GNUPGHOME:-$HOME/.gnupg}/S.gpg-agent" ]];
   source "$_gpg_agent_env" 2> /dev/null
 
   # Start gpg-agent if not started.
-  if ! ps -U "$USER" -o pid,ucomm | grep -q -- "${${${(s.:.)GPG_AGENT_INFO}[2]}:--1} gpg-agent"; then
+  if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q -- "${${${(s.:.)GPG_AGENT_INFO}[2]}:--1} gpg-agent"; then
     eval "$(gpg-agent --daemon | tee "$_gpg_agent_env")"
   fi
 fi
diff --git a/modules/ssh/init.zsh b/modules/ssh/init.zsh
index d8b5937..f632328 100644
--- a/modules/ssh/init.zsh
+++ b/modules/ssh/init.zsh
@@ -25,7 +25,7 @@ if [[ ! -S "$SSH_AUTH_SOCK" ]]; then
   source "$_ssh_agent_env" 2> /dev/null
 
   # Start ssh-agent if not started.
-  if ! ps -U "$USER" -o pid,ucomm | grep -q -- "${SSH_AGENT_PID:--1} ssh-agent"; then
+  if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q -- "${SSH_AGENT_PID:--1} ssh-agent"; then
     eval "$(ssh-agent | sed '/^echo /d' | tee "$_ssh_agent_env")"
   fi
 fi
diff --git a/modules/utility/init.zsh b/modules/utility/init.zsh
index a32e5f3..491af6a 100644
--- a/modules/utility/init.zsh
+++ b/modules/utility/init.zsh
@@ -191,5 +191,5 @@ function find-exec {
 
 # Displays user owned processes status.
 function psu {
-  ps -U "${1:-$USER}" -o 'pid,%cpu,%mem,command' "${(@)argv[2,-1]}"
+  ps -U "${1:-$LOGNAME}" -o 'pid,%cpu,%mem,command' "${(@)argv[2,-1]}"
 }
diff --git a/runcoms/zprofile b/runcoms/zprofile
index 08d39be..4daeb13 100644
--- a/runcoms/zprofile
+++ b/runcoms/zprofile
@@ -67,7 +67,7 @@ fi
 #
 
 if [[ ! -d "$TMPDIR" ]]; then
-  export TMPDIR="/tmp/$USER"
+  export TMPDIR="/tmp/$LOGNAME"
   mkdir -p -m 700 "$TMPDIR"
 fi