… | |
… | |
71 | struct passwd *pwent = getpwuid (getuid ()); |
71 | struct passwd *pwent = getpwuid (getuid ()); |
72 | |
72 | |
73 | if (!strncmp (pty, "/dev/", 5)) |
73 | if (!strncmp (pty, "/dev/", 5)) |
74 | pty += 5; /* skip /dev/ prefix */ |
74 | pty += 5; /* skip /dev/ prefix */ |
75 | |
75 | |
|
|
76 | #ifdef HAVE_UTMP_PID |
76 | if (!strncmp (pty, "pty", 3) || !strncmp (pty, "tty", 3)) |
77 | if (!strncmp (pty, "pty", 3) || !strncmp (pty, "tty", 3)) |
77 | strncpy (ut_id, (pty + 3), sizeof (ut_id)); |
78 | strncpy (ut_id, pty + 3, sizeof (ut_id)); |
78 | #ifdef HAVE_UTMP_PID |
|
|
79 | else if (sscanf (pty, "pts/%d", &i) == 1) |
79 | else if (sscanf (pty, "pts/%d", &i) == 1) |
80 | sprintf (ut_id, "vt%02x", (i & 0xff)); /* sysv naming */ |
80 | sprintf (ut_id, "vt%02x", (i & 0xff)); /* sysv naming */ |
81 | #endif |
|
|
82 | else if (strncmp (pty, "pty", 3) && strncmp (pty, "tty", 3)) |
81 | else if (strncmp (pty, "pty", 3) && strncmp (pty, "tty", 3)) |
83 | { |
82 | { |
84 | 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); |
85 | return; |
84 | return; |
86 | } |
85 | } |
|
|
86 | #endif |
87 | |
87 | |
88 | #ifdef HAVE_STRUCT_UTMP |
88 | #ifdef HAVE_STRUCT_UTMP |
89 | memset (ut, 0, sizeof (struct utmp)); |
89 | memset (ut, 0, sizeof (struct utmp)); |
90 | # ifdef HAVE_UTMP_PID |
90 | # ifdef HAVE_UTMP_PID |
91 | setutent (); |
91 | setutent (); |