--- rxvt-unicode/src/logging.C 2005/11/08 17:35:28 1.18 +++ rxvt-unicode/src/logging.C 2006/01/16 09:10:16 1.23 @@ -39,17 +39,18 @@ * rxvt_update_wtmp (); *----------------------------------------------------------------------*/ -#include "../config.h" /* NECESSARY */ -#include "rxvt.h" /* NECESSARY */ +#include "../config.h" +#include "rxvt.h" #include "logging.h" + #ifdef UTMP_SUPPORT #if HAVE_STRUCT_UTMP -int rxvt_write_bsd_utmp (int utmp_pos, struct utmp *wu); -void rxvt_update_wtmp (const char *fname, const struct utmp *putmp); +static int rxvt_write_bsd_utmp (int utmp_pos, struct utmp *wu); +static void rxvt_update_wtmp (const char *fname, const struct utmp *putmp); #endif -void rxvt_update_lastlog (const char *fname, const char *pty, const char *host); +static void rxvt_update_lastlog (const char *fname, const char *pty, const char *host); /* * BSD style utmp entry @@ -72,15 +73,13 @@ #ifdef HAVE_STRUCT_UTMPX struct utmpx *utx = &this->utx; #endif -#ifdef HAVE_UTMP_PID int i; -#endif struct passwd *pwent = getpwuid (getuid ()); if (!strncmp (pty, "/dev/", 5)) pty += 5; /* skip /dev/ prefix */ -#ifdef HAVE_UTMP_PID +#if defined(HAVE_UTMP_PID) || defined(HAVE_STRUCT_UTMPX) if (!strncmp (pty, "pty", 3) || !strncmp (pty, "tty", 3)) strncpy (ut_id, pty + 3, sizeof (ut_id)); else if (sscanf (pty, "pts/%d", &i) == 1) @@ -99,7 +98,7 @@ strncpy (ut->ut_id, ut_id, sizeof (ut->ut_id)); ut->ut_type = DEAD_PROCESS; getutid (ut); /* position to entry in utmp file */ - strncpy (ut_id, ut_id, sizeof (ut_id)); + strncpy (this->ut_id, ut_id, sizeof (this->ut_id)); # endif #endif @@ -109,7 +108,7 @@ strncpy (utx->ut_id, ut_id, sizeof (utx->ut_id)); utx->ut_type = DEAD_PROCESS; getutxid (utx); /* position to entry in utmp file */ - strncpy (ut_id, ut_id, sizeof (ut_id)); + strncpy (this->ut_id, ut_id, sizeof (this->ut_id)); #endif #ifdef HAVE_STRUCT_UTMP @@ -168,7 +167,6 @@ #if defined(HAVE_STRUCT_UTMP) && !defined(HAVE_UTMP_PID) { - int i; # ifdef HAVE_TTYSLOT i = ttyslot (); if (rxvt_write_bsd_utmp (i, ut)) @@ -198,13 +196,12 @@ fclose (fd0); } # endif - } #endif #ifdef WTMP_SUPPORT # ifdef WTMP_ONLY_ON_LOGIN - if (options & Opt_loginShell) + if (OPTION (Opt_loginShell)) # endif { # ifdef HAVE_STRUCT_UTMP @@ -214,17 +211,13 @@ 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 #if defined(LASTLOG_SUPPORT) && defined(RXVT_LASTLOG_FILE) - if (options & Opt_loginShell) + if (OPTION (Opt_loginShell)) rxvt_update_lastlog (RXVT_LASTLOG_FILE, pty, hostname); #endif } @@ -247,7 +240,7 @@ # ifdef HAVE_UTMP_PID memset (ut, 0, sizeof (struct utmp)); setutent (); - strncpy (ut->ut_id, ut_id, sizeof (ut->ut_id)); + strncpy (ut->ut_id, this->ut_id, sizeof (ut->ut_id)); ut->ut_type = USER_PROCESS; { struct utmp *tmput = getutid (ut); @@ -268,7 +261,7 @@ #ifdef HAVE_STRUCT_UTMPX memset (utx, 0, sizeof (struct utmpx)); setutxent (); - strncpy (utx->ut_id, ut_id, sizeof (utx->ut_id)); + strncpy (utx->ut_id, this->ut_id, sizeof (utx->ut_id)); utx->ut_type = USER_PROCESS; if ((tmputx = getutxid (utx))) /* position to entry in utmp file */ utx = tmputx; @@ -285,7 +278,7 @@ */ #ifdef WTMP_SUPPORT # ifdef WTMP_ONLY_ON_LOGIN - if (options & Opt_loginShell) + if (OPTION (Opt_loginShell)) # endif { # ifdef HAVE_STRUCT_UTMP @@ -329,8 +322,8 @@ /* * Write a BSD style utmp entry */ -#ifdef HAVE_UTMP_H -int +#if defined(HAVE_STRUCT_UTMP) && !defined(HAVE_UTMP_PID) +static int rxvt_write_bsd_utmp (int utmp_pos, struct utmp *wu) { int fd; @@ -350,7 +343,7 @@ * Update a BSD style wtmp entry */ #if defined(WTMP_SUPPORT) && !defined(HAVE_UPDWTMP) && defined(HAVE_STRUCT_UTMP) -void +static void rxvt_update_wtmp (const char *fname, const struct utmp *putmp) { int fd, gotlock, retry; @@ -391,7 +384,7 @@ /* ------------------------------------------------------------------------- */ #ifdef LASTLOG_SUPPORT -void +static void rxvt_update_lastlog (const char *fname, const char *pty, const char *host) { # ifdef HAVE_STRUCT_LASTLOGX