… | |
… | |
12 | * Copyright (c) 1997 Raul Garcia Garcia <rgg@tid.es> |
12 | * Copyright (c) 1997 Raul Garcia Garcia <rgg@tid.es> |
13 | * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> |
13 | * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> |
14 | * - extensive modifications |
14 | * - extensive modifications |
15 | * Copyright (c) 1999 D J Hawkey Jr <hawkeyd@visi.com> |
15 | * Copyright (c) 1999 D J Hawkey Jr <hawkeyd@visi.com> |
16 | * - lastlog support |
16 | * - lastlog support |
17 | * Copyright (c) 2004 Marc Lehmann <pcg@goof.com> |
17 | * Copyright (c) 2004-2006 Marc Lehmann <pcg@goof.com> |
18 | * |
18 | * |
19 | * This program is free software; you can redistribute it and/or modify |
19 | * This program is free software; you can redistribute it and/or modify |
20 | * it under the terms of the GNU General Public License as published by |
20 | * it under the terms of the GNU General Public License as published by |
21 | * the Free Software Foundation; either version 2 of the License, or |
21 | * the Free Software Foundation; either version 2 of the License, or |
22 | * (at your option) any later version. |
22 | * (at your option) any later version. |
… | |
… | |
55 | |
55 | |
56 | /* |
56 | /* |
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_unix::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 |
… | |
… | |
222 | /* ------------------------------------------------------------------------- */ |
225 | /* ------------------------------------------------------------------------- */ |
223 | /* |
226 | /* |
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_unix::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 |