--- rxvt-unicode/src/logging.C 2003/11/24 17:31:27 1.2 +++ rxvt-unicode/src/logging.C 2004/01/31 03:27:45 1.5 @@ -1,7 +1,6 @@ /*--------------------------------*-C-*---------------------------------* * File: logging.c *----------------------------------------------------------------------* - * $Id: logging.C,v 1.2 2003/11/24 17:31:27 pcg Exp $ * * All portions of code are copyright by their respective author/s. * Copyright (c) 1992 John Bovey @@ -56,15 +55,14 @@ /* * make and write utmp and wtmp entries */ -/* EXTPROTO */ void -rxvt_makeutent(pR_ const char *pty, const char *hostname) +rxvt_term::makeutent (const char *pty, const char *hostname) { #ifdef HAVE_STRUCT_UTMP - struct utmp *ut = &(R->h->ut); + struct utmp *ut = &(this->ut); #endif #ifdef HAVE_STRUCT_UTMPX - struct utmpx *utx = &(R->h->utx); + struct utmpx *utx = &(this->utx); #endif #ifdef HAVE_UTMP_PID int i; @@ -94,7 +92,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(R->h->ut_id, ut_id, sizeof(R->h->ut_id)); + STRNCPY(ut_id, ut_id, sizeof(ut_id)); # endif #endif @@ -104,7 +102,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(R->h->ut_id, ut_id, sizeof(R->h->ut_id)); + STRNCPY(ut_id, ut_id, sizeof(ut_id)); #endif #ifdef HAVE_STRUCT_UTMP @@ -115,14 +113,14 @@ sizeof(ut->ut_user)); STRNCPY(ut->ut_id, ut_id, sizeof(ut->ut_id)); ut->ut_time = time(NULL); - ut->ut_pid = R->h->cmd_pid; + ut->ut_pid = cmd_pid; # ifdef HAVE_UTMP_HOST STRNCPY(ut->ut_host, hostname, sizeof(ut->ut_host)); # endif ut->ut_type = USER_PROCESS; pututline(ut); endutent(); /* close the file */ - R->h->utmp_pos = 0; + utmp_pos = 0; # else STRNCPY(ut->ut_name, (pwent && pwent->pw_name) ? pwent->pw_name : "?", sizeof(ut->ut_name)); @@ -140,7 +138,7 @@ utx->ut_session = getsid(0); utx->ut_tv.tv_sec = time(NULL); utx->ut_tv.tv_usec = 0; - utx->ut_pid = R->h->cmd_pid; + utx->ut_pid = cmd_pid; # ifdef HAVE_UTMPX_HOST STRNCPY(utx->ut_host, hostname, sizeof(utx->ut_host)); # if 0 @@ -155,7 +153,7 @@ utx->ut_type = USER_PROCESS; pututxline(utx); endutxent(); /* close the file */ - R->h->utmp_pos = 0; + utmp_pos = 0; #endif #if defined(HAVE_STRUCT_UTMP) && !defined(HAVE_UTMP_PID) @@ -164,7 +162,7 @@ # ifdef HAVE_TTYSLOT i = ttyslot(); if (rxvt_write_bsd_utmp(i, ut)) - R->h->utmp_pos = i; + utmp_pos = i; # else FILE *fd0; @@ -178,7 +176,7 @@ if (!STRCMP(ut->ut_line, name)) { if (!rxvt_write_bsd_utmp(i, ut)) i = 0; - R->h->utmp_pos = i; + utmp_pos = i; fclose(fd0); break; } @@ -192,7 +190,7 @@ #ifdef WTMP_SUPPORT # ifdef WTMP_ONLY_ON_LOGIN - if (R->Options & Opt_loginShell) + if (Options & Opt_loginShell) # endif { # ifdef HAVE_STRUCT_UTMP @@ -208,7 +206,7 @@ } #endif #if defined(LASTLOG_SUPPORT) && defined(RXVT_LASTLOG_FILE) - if (R->Options & Opt_loginShell) + if (Options & Opt_loginShell) rxvt_update_lastlog(RXVT_LASTLOG_FILE, pty, hostname); #endif } @@ -217,22 +215,21 @@ /* * remove utmp and wtmp entries */ -/* EXTPROTO */ void -rxvt_cleanutent(pR) +rxvt_term::cleanutent () { #ifdef HAVE_STRUCT_UTMP - struct utmp *ut = &(R->h->ut); + struct utmp *ut = &(this->ut); #endif #ifdef HAVE_STRUCT_UTMPX - struct utmpx *tmputx, *utx = &(R->h->utx); + struct utmpx *tmputx, *utx = &(this->utx); #endif #ifdef HAVE_STRUCT_UTMP # ifdef HAVE_UTMP_PID MEMSET(ut, 0, sizeof(struct utmp)); setutent(); - STRNCPY(ut->ut_id, R->h->ut_id, sizeof(ut->ut_id)); + STRNCPY(ut->ut_id, ut_id, sizeof(ut->ut_id)); ut->ut_type = USER_PROCESS; { struct utmp *tmput = getutid(ut); @@ -253,7 +250,7 @@ #ifdef HAVE_STRUCT_UTMPX MEMSET(utx, 0, sizeof(struct utmpx)); setutxent(); - STRNCPY(utx->ut_id, R->h->ut_id, sizeof(utx->ut_id)); + STRNCPY(utx->ut_id, ut_id, sizeof(utx->ut_id)); utx->ut_type = USER_PROCESS; if ((tmputx = getutxid(utx))) /* position to entry in utmp file */ utx = tmputx; @@ -268,7 +265,7 @@ */ #ifdef WTMP_SUPPORT # ifdef WTMP_ONLY_ON_LOGIN - if (R->Options & Opt_loginShell) + if (Options & Opt_loginShell) # endif { # ifdef HAVE_STRUCT_UTMP @@ -289,16 +286,16 @@ */ #ifdef HAVE_STRUCT_UTMP # ifdef HAVE_UTMP_PID - if (ut->ut_pid == R->h->cmd_pid) + if (ut->ut_pid == cmd_pid) pututline(ut); endutent(); # else MEMSET(ut, 0, sizeof(struct utmp)); - rxvt_write_bsd_utmp(R->h->utmp_pos, ut); + rxvt_write_bsd_utmp(utmp_pos, ut); # endif #endif #ifdef HAVE_STRUCT_UTMPX - if (utx->ut_pid == R->h->cmd_pid) + if (utx->ut_pid == cmd_pid) pututxline(utx); endutxent(); #endif