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.11 by root, Sun Aug 15 22:09:24 2004 UTC vs.
Revision 1.13 by root, Fri Feb 4 04:16:05 2005 UTC

58 */ 58 */
59void 59void
60rxvt_term::makeutent (const char *pty, const char *hostname) 60rxvt_term::makeutent (const char *pty, const char *hostname)
61{ 61{
62#ifdef HAVE_STRUCT_UTMP 62#ifdef HAVE_STRUCT_UTMP
63 struct utmp *ut = & (this->ut); 63 struct utmp *ut = &this->ut;
64#endif 64#endif
65#ifdef HAVE_STRUCT_UTMPX 65#ifdef HAVE_STRUCT_UTMPX
66 struct utmpx *utx = & (this->utx); 66 struct utmpx *utx = &this->utx;
67#endif 67#endif
68#ifdef HAVE_UTMP_PID 68#ifdef HAVE_UTMP_PID
69 int i; 69 int i;
70#endif 70#endif
71 char ut_id[5];
72 struct passwd *pwent = getpwuid (getuid ()); 71 struct passwd *pwent = getpwuid (getuid ());
73 72
74 if (!strncmp (pty, "/dev/", 5)) 73 if (!strncmp (pty, "/dev/", 5))
75 pty += 5; /* skip /dev/ prefix */ 74 pty += 5; /* skip /dev/ prefix */
76 75
76#ifdef HAVE_UTMP_PID
77 if (!strncmp (pty, "pty", 3) || !strncmp (pty, "tty", 3)) 77 if (!strncmp (pty, "pty", 3) || !strncmp (pty, "tty", 3))
78 {
79 strncpy (ut_id, (pty + 3), sizeof (ut_id)); 78 strncpy (ut_id, pty + 3, sizeof (ut_id));
80 }
81#ifdef HAVE_UTMP_PID
82 else if (sscanf (pty, "pts/%d", &i) == 1) 79 else if (sscanf (pty, "pts/%d", &i) == 1)
83 sprintf (ut_id, "vt%02x", (i & 0xff)); /* sysv naming */ 80 sprintf (ut_id, "vt%02x", (i & 0xff)); /* sysv naming */
84#endif
85 else if (strncmp (pty, "pty", 3) && strncmp (pty, "tty", 3)) 81 else if (strncmp (pty, "pty", 3) && strncmp (pty, "tty", 3))
86 { 82 {
87 rxvt_warn ("can't parse tty name \"%s\", not adding utmp entry.\n", pty); 83 rxvt_warn ("can't parse tty name \"%s\", not adding utmp entry.\n", pty);
88 return; 84 return;
89 } 85 }
86#endif
90 87
91#ifdef HAVE_STRUCT_UTMP 88#ifdef HAVE_STRUCT_UTMP
92 memset (ut, 0, sizeof (struct utmp)); 89 memset (ut, 0, sizeof (struct utmp));
93# ifdef HAVE_UTMP_PID 90# ifdef HAVE_UTMP_PID
94 setutent (); 91 setutent ();
225 */ 222 */
226void 223void
227rxvt_term::cleanutent () 224rxvt_term::cleanutent ()
228{ 225{
229#ifdef HAVE_STRUCT_UTMP 226#ifdef HAVE_STRUCT_UTMP
230 struct utmp *ut = & (this->ut); 227 struct utmp *ut = &this->ut;
231#endif 228#endif
232#ifdef HAVE_STRUCT_UTMPX 229#ifdef HAVE_STRUCT_UTMPX
233 struct utmpx *tmputx, *utx = & (this->utx); 230 struct utmpx *tmputx, *utx = &this->utx;
234#endif 231#endif
235 232
236#ifdef HAVE_STRUCT_UTMP 233#ifdef HAVE_STRUCT_UTMP
237# ifdef HAVE_UTMP_PID 234# ifdef HAVE_UTMP_PID
238 memset (ut, 0, sizeof (struct utmp)); 235 memset (ut, 0, sizeof (struct utmp));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines