ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/logging.C
(Generate patch)

Comparing rxvt-unicode/src/logging.C (file contents):
Revision 1.25 by root, Tue Jan 17 06:06:42 2006 UTC vs.
Revision 1.27 by root, Tue Jan 17 10:14:26 2006 UTC

31 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 31 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
32 *----------------------------------------------------------------------*/ 32 *----------------------------------------------------------------------*/
33 33
34#include "../config.h" 34#include "../config.h"
35#include "rxvt.h" 35#include "rxvt.h"
36#include "logging.h" 36#include "ptytty.h"
37 37
38#ifdef UTMP_SUPPORT 38#if UTMP_SUPPORT
39 39
40#if HAVE_STRUCT_UTMP 40#if HAVE_STRUCT_UTMP
41static int rxvt_write_bsd_utmp (int utmp_pos, struct utmp *wu); 41static int rxvt_write_bsd_utmp (int utmp_pos, struct utmp *wu);
42static void rxvt_update_wtmp (const char *fname, const struct utmp *putmp); 42static void rxvt_update_wtmp (const char *fname, const struct utmp *putmp);
43#endif 43#endif
55 55
56/* 56/*
57 * make and write utmp and wtmp entries 57 * make and write utmp and wtmp entries
58 */ 58 */
59void 59void
60rxvt_session::login (const char *pty, int cmd_pid, bool login_shell, const char *hostname) 60rxvt_ptytty::login (int cmd_pid, bool login_shell, const char *hostname)
61{ 61{
62 this->cmd_pid = cmd_pid; 62 this->cmd_pid = cmd_pid;
63 this->login_shell = login_shell; 63 this->login_shell = login_shell;
64
65 const char *pty = name;
64 66
65#ifdef HAVE_STRUCT_UTMP 67#ifdef HAVE_STRUCT_UTMP
66 struct utmp *ut = &this->ut; 68 struct utmp *ut = &this->ut;
67#endif 69#endif
68#ifdef HAVE_STRUCT_UTMPX 70#ifdef HAVE_STRUCT_UTMPX
220/* ------------------------------------------------------------------------- */ 222/* ------------------------------------------------------------------------- */
221/* 223/*
222 * remove utmp and wtmp entries 224 * remove utmp and wtmp entries
223 */ 225 */
224void 226void
225rxvt_session::logout () 227rxvt_ptytty::logout ()
226{ 228{
227#ifdef HAVE_STRUCT_UTMP 229#ifdef HAVE_STRUCT_UTMP
228 struct utmp *ut = &this->ut; 230 struct utmp *tmput, *ut = &this->ut;
229#endif 231#endif
230#ifdef HAVE_STRUCT_UTMPX 232#ifdef HAVE_STRUCT_UTMPX
231 struct utmpx *tmputx, *utx = &this->utx; 233 struct utmpx *tmputx, *utx = &this->utx;
232#endif 234#endif
233 235
235# ifdef HAVE_UTMP_PID 237# ifdef HAVE_UTMP_PID
236 memset (ut, 0, sizeof (struct utmp)); 238 memset (ut, 0, sizeof (struct utmp));
237 setutent (); 239 setutent ();
238 strncpy (ut->ut_id, this->ut_id, sizeof (ut->ut_id)); 240 strncpy (ut->ut_id, this->ut_id, sizeof (ut->ut_id));
239 ut->ut_type = USER_PROCESS; 241 ut->ut_type = USER_PROCESS;
240 {
241 struct utmp *tmput = getutid (ut);
242
243 if (tmput) /* position to entry in utmp file */ 242 if ((tmput = getutid (ut))) /* position to entry in utmp file */
244 ut = tmput; 243 ut = tmput;
245 }
246 ut->ut_type = DEAD_PROCESS; 244 ut->ut_type = DEAD_PROCESS;
247# else 245# else
248 memset (ut->ut_name, 0, sizeof (ut->ut_name)); 246 memset (ut->ut_name, 0, sizeof (ut->ut_name));
249# ifdef HAVE_UTMP_HOST 247# ifdef HAVE_UTMP_HOST
250 memset (ut->ut_host, 0, sizeof (ut->ut_host)); 248 memset (ut->ut_host, 0, sizeof (ut->ut_host));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines