… | |
… | |
57 | * make and write utmp and wtmp entries |
57 | * make and write utmp and wtmp entries |
58 | */ |
58 | */ |
59 | void |
59 | void |
60 | rxvt_ptytty::login (int cmd_pid, bool login_shell, const char *hostname) |
60 | rxvt_ptytty::login (int cmd_pid, bool login_shell, const char *hostname) |
61 | { |
61 | { |
|
|
62 | const char *pty = name; |
|
|
63 | |
|
|
64 | if (!pty || !*pty) |
|
|
65 | return; |
|
|
66 | |
62 | this->cmd_pid = cmd_pid; |
67 | this->cmd_pid = cmd_pid; |
63 | this->login_shell = login_shell; |
68 | this->login_shell = login_shell; |
64 | |
|
|
65 | const char *pty = name; |
|
|
66 | |
69 | |
67 | #ifdef HAVE_STRUCT_UTMP |
70 | #ifdef HAVE_STRUCT_UTMP |
68 | struct utmp *ut = &this->ut; |
71 | struct utmp *ut = &this->ut; |
69 | #endif |
72 | #endif |
70 | #ifdef HAVE_STRUCT_UTMPX |
73 | #ifdef HAVE_STRUCT_UTMPX |
… | |
… | |
224 | * remove utmp and wtmp entries |
227 | * remove utmp and wtmp entries |
225 | */ |
228 | */ |
226 | void |
229 | void |
227 | rxvt_ptytty::logout () |
230 | rxvt_ptytty::logout () |
228 | { |
231 | { |
|
|
232 | if (!cmd_pid) |
|
|
233 | return; |
|
|
234 | |
229 | #ifdef HAVE_STRUCT_UTMP |
235 | #ifdef HAVE_STRUCT_UTMP |
230 | struct utmp *tmput, *ut = &this->ut; |
236 | struct utmp *tmput, *ut = &this->ut; |
231 | #endif |
237 | #endif |
232 | #ifdef HAVE_STRUCT_UTMPX |
238 | #ifdef HAVE_STRUCT_UTMPX |
233 | struct utmpx *tmputx, *utx = &this->utx; |
239 | struct utmpx *tmputx, *utx = &this->utx; |
… | |
… | |
303 | #ifdef HAVE_STRUCT_UTMPX |
309 | #ifdef HAVE_STRUCT_UTMPX |
304 | if (utx->ut_pid == cmd_pid) |
310 | if (utx->ut_pid == cmd_pid) |
305 | pututxline (utx); |
311 | pututxline (utx); |
306 | endutxent (); |
312 | endutxent (); |
307 | #endif |
313 | #endif |
|
|
314 | |
|
|
315 | cmd_pid = 0; |
308 | } |
316 | } |
309 | |
317 | |
310 | /* ------------------------------------------------------------------------- */ |
318 | /* ------------------------------------------------------------------------- */ |
311 | /* |
319 | /* |
312 | * Write a BSD style utmp entry |
320 | * Write a BSD style utmp entry |