--- rxvt-unicode/src/logging.C 2006/01/16 09:10:16 1.23 +++ rxvt-unicode/src/logging.C 2006/01/17 10:14:26 1.27 @@ -30,20 +30,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ -/*----------------------------------------------------------------------* - * Public: - * extern void cleanutent (void); - * extern void makeutent (const char * pty, const char * hostname); - * - * Private: - * rxvt_update_wtmp (); - *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" -#include "logging.h" +#include "ptytty.h" -#ifdef UTMP_SUPPORT +#if UTMP_SUPPORT #if HAVE_STRUCT_UTMP static int rxvt_write_bsd_utmp (int utmp_pos, struct utmp *wu); @@ -65,8 +57,13 @@ * make and write utmp and wtmp entries */ void -rxvt_term::makeutent (const char *pty, const char *hostname) +rxvt_ptytty::login (int cmd_pid, bool login_shell, const char *hostname) { + this->cmd_pid = cmd_pid; + this->login_shell = login_shell; + + const char *pty = name; + #ifdef HAVE_STRUCT_UTMP struct utmp *ut = &this->ut; #endif @@ -201,7 +198,7 @@ #ifdef WTMP_SUPPORT # ifdef WTMP_ONLY_ON_LOGIN - if (OPTION (Opt_loginShell)) + if (login_shell) # endif { # ifdef HAVE_STRUCT_UTMP @@ -217,7 +214,7 @@ } #endif #if defined(LASTLOG_SUPPORT) && defined(RXVT_LASTLOG_FILE) - if (OPTION (Opt_loginShell)) + if (login_shell) rxvt_update_lastlog (RXVT_LASTLOG_FILE, pty, hostname); #endif } @@ -227,10 +224,10 @@ * remove utmp and wtmp entries */ void -rxvt_term::cleanutent () +rxvt_ptytty::logout () { #ifdef HAVE_STRUCT_UTMP - struct utmp *ut = &this->ut; + struct utmp *tmput, *ut = &this->ut; #endif #ifdef HAVE_STRUCT_UTMPX struct utmpx *tmputx, *utx = &this->utx; @@ -242,12 +239,8 @@ setutent (); strncpy (ut->ut_id, this->ut_id, sizeof (ut->ut_id)); ut->ut_type = USER_PROCESS; - { - struct utmp *tmput = getutid (ut); - - if (tmput) /* position to entry in utmp file */ - ut = tmput; - } + if ((tmput = getutid (ut))) /* position to entry in utmp file */ + ut = tmput; ut->ut_type = DEAD_PROCESS; # else memset (ut->ut_name, 0, sizeof (ut->ut_name)); @@ -278,7 +271,7 @@ */ #ifdef WTMP_SUPPORT # ifdef WTMP_ONLY_ON_LOGIN - if (OPTION (Opt_loginShell)) + if (login_shell) # endif { # ifdef HAVE_STRUCT_UTMP @@ -288,12 +281,8 @@ rxvt_update_wtmp (RXVT_WTMP_FILE, ut); # endif # endif -# ifdef HAVE_STRUCT_UTMPX -# if HAVE_UPDWTMPX +# if defined(HAVE_STRUCT_UTMPX) && defined(HAVE_UPDWTMPX) updwtmpx (RXVT_WTMPX_FILE, utx); -# else - pututxline (utx); -# endif # endif } #endif