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.12 by root, Wed Jan 19 15:20:47 2005 UTC vs.
Revision 1.14 by root, Wed Feb 16 20:32:05 2005 UTC

42#include "../config.h" /* NECESSARY */ 42#include "../config.h" /* NECESSARY */
43#include "rxvt.h" /* NECESSARY */ 43#include "rxvt.h" /* NECESSARY */
44#include "logging.h" 44#include "logging.h"
45#ifdef UTMP_SUPPORT 45#ifdef UTMP_SUPPORT
46 46
47int rxvt_write_bsd_utmp (int utmp_pos, struct utmp *wu);
48void rxvt_update_wtmp (const char *fname, const struct utmp *putmp);
49void rxvt_update_lastlog (const char *fname, const char *pty, const char *host);
50
47/* 51/*
48 * BSD style utmp entry 52 * BSD style utmp entry
49 * ut_line, ut_name, ut_host, ut_time 53 * ut_line, ut_name, ut_host, ut_time
50 * SYSV style utmp (and utmpx) entry 54 * SYSV style utmp (and utmpx) entry
51 * ut_user, ut_id, ut_line, ut_pid, ut_type, ut_exit, ut_time 55 * ut_user, ut_id, ut_line, ut_pid, ut_type, ut_exit, ut_time
71 struct passwd *pwent = getpwuid (getuid ()); 75 struct passwd *pwent = getpwuid (getuid ());
72 76
73 if (!strncmp (pty, "/dev/", 5)) 77 if (!strncmp (pty, "/dev/", 5))
74 pty += 5; /* skip /dev/ prefix */ 78 pty += 5; /* skip /dev/ prefix */
75 79
80#ifdef HAVE_UTMP_PID
76 if (!strncmp (pty, "pty", 3) || !strncmp (pty, "tty", 3)) 81 if (!strncmp (pty, "pty", 3) || !strncmp (pty, "tty", 3))
77 strncpy (ut_id, (pty + 3), sizeof (ut_id)); 82 strncpy (ut_id, pty + 3, sizeof (ut_id));
78#ifdef HAVE_UTMP_PID
79 else if (sscanf (pty, "pts/%d", &i) == 1) 83 else if (sscanf (pty, "pts/%d", &i) == 1)
80 sprintf (ut_id, "vt%02x", (i & 0xff)); /* sysv naming */ 84 sprintf (ut_id, "vt%02x", (i & 0xff)); /* sysv naming */
81#endif
82 else if (strncmp (pty, "pty", 3) && strncmp (pty, "tty", 3)) 85 else if (strncmp (pty, "pty", 3) && strncmp (pty, "tty", 3))
83 { 86 {
84 rxvt_warn ("can't parse tty name \"%s\", not adding utmp entry.\n", pty); 87 rxvt_warn ("can't parse tty name \"%s\", not adding utmp entry.\n", pty);
85 return; 88 return;
86 } 89 }
90#endif
87 91
88#ifdef HAVE_STRUCT_UTMP 92#ifdef HAVE_STRUCT_UTMP
89 memset (ut, 0, sizeof (struct utmp)); 93 memset (ut, 0, sizeof (struct utmp));
90# ifdef HAVE_UTMP_PID 94# ifdef HAVE_UTMP_PID
91 setutent (); 95 setutent ();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines