src/keyboard.C
src/keyboard.h
src/logging.C
-src/logging.h
src/main.C
src/misc.C
src/netdisp.C
keyboard.o: command.h
logging.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h
logging.o: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h
-logging.o: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h logging.h
+logging.o: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h
main.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h encoding.h
main.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
main.o: salloc.h rxvtperl.h hookinc.h rsinc.h keyboard.h
keyboard.lo: command.h
logging.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h
logging.lo: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h
-logging.lo: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h logging.h
+logging.lo: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h
main.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h encoding.h
main.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
main.lo: salloc.h rxvtperl.h hookinc.h rsinc.h keyboard.h
void
rxvt_ptytty::login (int cmd_pid, bool login_shell, const char *hostname)
{
+ const char *pty = name;
+
+ if (!pty || !*pty)
+ return;
+
this->cmd_pid = cmd_pid;
this->login_shell = login_shell;
- const char *pty = name;
-
#ifdef HAVE_STRUCT_UTMP
struct utmp *ut = &this->ut;
#endif
void
rxvt_ptytty::logout ()
{
+ if (!cmd_pid)
+ return;
+
#ifdef HAVE_STRUCT_UTMP
struct utmp *tmput, *ut = &this->ut;
#endif
pututxline (utx);
endutxent ();
#endif
+
+ cmd_pid = 0;
}
/* ------------------------------------------------------------------------- */
+++ /dev/null
-#ifndef LOGGING_H_
-#define LOGGING_H_
-
-#ifdef UTMP_SUPPORT
-# if !defined(RXVT_UTMPX_FILE) || !defined(HAVE_STRUCT_UTMPX)
-# undef HAVE_UTMPX_H
-# undef HAVE_STRUCT_UTMPX
-# endif
-# if !defined(RXVT_UTMP_FILE) || !defined(HAVE_STRUCT_UTMP)
-# undef HAVE_UTMP_H
-# undef HAVE_STRUCT_UTMP
-# endif
-
-# ifdef HAVE_UTMPX_H
-# include <utmpx.h>
-# endif
-# ifdef HAVE_UTMP_H
-# include <utmp.h>
-# endif
-
-# if ! defined(HAVE_STRUCT_UTMPX) && ! defined(HAVE_STRUCT_UTMP)
-# error cannot build with utmp support - no utmp or utmpx struct found
-# endif
-
-# ifdef HAVE_LASTLOG_H
-# include <lastlog.h>
-# endif
-
-# include <pwd.h>
-
-# ifdef RXVT_UTMP_SYSV
-# ifndef USER_PROCESS
-# define USER_PROCESS 7
-# endif
-# ifndef DEAD_PROCESS
-# define DEAD_PROCESS 8
-# endif
-# endif
-
-# ifdef __QNX__
-# include <sys/utsname.h>
-# define ut_name ut_user
-# endif
-
-struct rxvt_session
-{
- int utmp_pos;
- int cmd_pid;
- bool login_shell;
-
-#ifdef HAVE_STRUCT_UTMP
- struct utmp ut;
-#endif
-#ifdef HAVE_STRUCT_UTMPX
- struct utmpx utx;
-#endif
-#if (defined(HAVE_STRUCT_UTMP) && defined(HAVE_UTMP_PID)) || defined(HAVE_STRUCT_UTMPX)
- char ut_id[5];
-#endif
-
- void login (const char *pty, int cmd_pid, bool login_shell, const char *hostname);
- void logout ();
-};
-
-#endif
-
-#endif /* _LOGGING_H_ */
void
rxvt_term::privileged_utmp (rxvt_privaction action)
{
- if (OPTION (Opt_utmpInhibit)
- || !pty.name || !*pty.name)
+ if (OPTION (Opt_utmpInhibit))
return;
rxvt_privileges (RESTORE);
#ifndef NO_SETOWNER_TTYDEV
saved = false;
#endif
+#if UTMP_SUPPORT
+ cmd_pid = 0;
+#endif
}
rxvt_ptytty::~rxvt_ptytty ()
{
+ logout ();
put ();
}
# define NO_SETOWNER_TTYDEV 1
#endif
+#if UTMP_SUPPORT
+# if !defined(RXVT_UTMPX_FILE) || !defined(HAVE_STRUCT_UTMPX)
+# undef HAVE_UTMPX_H
+# undef HAVE_STRUCT_UTMPX
+# endif
+# if !defined(RXVT_UTMP_FILE) || !defined(HAVE_STRUCT_UTMP)
+# undef HAVE_UTMP_H
+# undef HAVE_STRUCT_UTMP
+# endif
+
+# ifdef HAVE_UTMPX_H
+# include <utmpx.h>
+# endif
+# ifdef HAVE_UTMP_H
+# include <utmp.h>
+# endif
+
+# if ! defined(HAVE_STRUCT_UTMPX) && ! defined(HAVE_STRUCT_UTMP)
+# error cannot build with utmp support - no utmp or utmpx struct found
+# endif
+
+# ifdef HAVE_LASTLOG_H
+# include <lastlog.h>
+# endif
+
+# include <pwd.h>
+
+# ifdef RXVT_UTMP_SYSV
+# ifndef USER_PROCESS
+# define USER_PROCESS 7
+# endif
+# ifndef DEAD_PROCESS
+# define DEAD_PROCESS 8
+# endif
+# endif
+
+# ifdef __QNX__
+# include <sys/utsname.h>
+# define ut_name ut_user
+# endif
+
+#endif
+
enum rxvt_privaction { IGNORE = 'i', SAVE = 's', RESTORE = 'r' };
struct rxvt_ptytty {
bool make_controlling_tty ();
void set_utf8_mode (bool on);
+
+#if UTMP_SUPPORT
+ int utmp_pos;
+ int cmd_pid;
+ bool login_shell;
+
+#ifdef HAVE_STRUCT_UTMP
+ struct utmp ut;
+#endif
+#ifdef HAVE_STRUCT_UTMPX
+ struct utmpx utx;
+#endif
+#if (defined(HAVE_STRUCT_UTMP) && defined(HAVE_UTMP_PID)) || defined(HAVE_STRUCT_UTMPX)
+ char ut_id[5];
+#endif
+
+ void login (int cmd_pid, bool login_shell, const char *hostname);
+ void logout ();
+#endif
};
#endif
char cmdbuf_base[CBUFSIZ];
rxvt_ptytty pty;
- rxvt_session session;
rxvt_salloc *talloc; // text line allocator
rxvt_salloc *ralloc; // rend line allocator
#endif
#include "ptytty.h"
-#include "logging.h"
extern "C" {
#include <X11/Intrinsic.h> /* Xlib, Xutil, Xresource, Xfuncproto */