Tue Dec 7 22:10:19 PST 1999 Michael Jennings <mej@eterm.org>

Support for RedHat's utempter library and some other fixes.  Thanks to
	Erik Troan <ewt@redhat.com> and Tim Powers <timp@redhat.com> for their
	help with this.


SVN revision: 1547
This commit is contained in:
Michael Jennings 1999-12-08 01:13:44 +00:00
parent b9864e98fe
commit 4af86536a7
7 changed files with 177 additions and 138 deletions

View File

@ -2890,3 +2890,10 @@ Mon Dec 6 21:53:23 PST 1999 Michael Jennings <mej@eterm.org>
will supercede any config file settings you have; that's life.
-------------------------------------------------------------------------------
Tue Dec 7 22:10:19 PST 1999 Michael Jennings <mej@eterm.org>
Support for RedHat's utempter library and some other fixes. Thanks to
Erik Troan <ewt@redhat.com> and Tim Powers <timp@redhat.com> for their
help with this.
-------------------------------------------------------------------------------

View File

@ -322,6 +322,7 @@
#undef FONT4
#undef DEF_FONT_IDX
#undef IOTRACE
#undef HAVE_UTEMPTER
/* Leave that blank line there!! Autoheader needs it.

View File

@ -272,12 +272,21 @@ AC_ARG_ENABLE(utmp,
[ --enable-utmp compile with utmp support],
if test "$enableval" != "no"; then
AC_MSG_RESULT(yes)
UTMP=1
AC_DEFINE(UTMP_SUPPORT)
else
AC_MSG_RESULT(no)
UTMP=0
fi, AC_MSG_RESULT(yes)
AC_DEFINE(UTMP_SUPPORT)
UTMP=1
)
if test $UTMP -eq 1; then
AC_CHECK_LIB(utempter, addToUtmp,
AC_DEFINE(HAVE_UTEMPTER)
LIBS="$LIBS -lutempter"
)
fi
AC_MSG_CHECKING(for backspace key configuration)
AC_ARG_WITH(backspace,
[ --with-backspace=KEY force backspace to send KEY (KEY is either \"bs\" for ^H or \"del\" for ^?)],

View File

@ -1060,7 +1060,7 @@ Exit_signal(int sig)
#ifdef UTMP_SUPPORT
privileges(INVOKE);
cleanutent();
remove_utmp_entry();
privileges(REVERT);
#endif
@ -1113,7 +1113,7 @@ clean_exit(void)
#endif /* __CYGWIN32__ */
#ifdef UTMP_SUPPORT
cleanutent();
remove_utmp_entry();
#endif
privileges(REVERT);
PABLO_STOP_TRACING();
@ -2200,8 +2200,9 @@ run_command(char *argv[])
}
#ifdef UTMP_SUPPORT
privileges(RESTORE);
if (Options & Opt_utmpLogging)
makeutent(ttydev, display_name); /* stamp /etc/utmp */
if (Options & Opt_utmpLogging) {
add_utmp_entry(ttydev, display_name, ptyfd);
}
privileges(IGNORE);
#endif

View File

@ -23,12 +23,19 @@
*
*/
#if !defined(ETERM_UTMP_H_) && defined(UTMP_SUPPORT)
#ifndef ETERM_UTMP_H_
#define ETERM_UTMP_H_
#include <X11/Xfuncproto.h>
#include <X11/Intrinsic.h> /* Xlib, Xutil, Xresource, Xfuncproto */
#ifdef UTMP_SUPPORT
# ifdef HAVE_UTEMPTER
# include <utempter.h>
# define add_utmp_entry(p, h, f) addToUtmp(p, h, f)
# define remove_utmp_entry() removeFromUtmp()
# endif
/************ Macros and Definitions ************/
# ifndef UTMP_FILENAME
# ifdef UTMP_FILE
@ -78,9 +85,16 @@
/************ Function Prototypes ************/
_XFUNCPROTOBEGIN
extern void makeutent(const char *, const char *);
extern void cleanutent(void);
# ifndef HAVE_UTEMPTER
extern void add_utmp_entry(const char *, const char *, int);
extern void remove_utmp_entry(void);
# endif
_XFUNCPROTOEND
#else /* UTMP_SUPPORT */
# define add_utmp_entry(p, h, f) NOP
# define remove_utmp_entry() NOP
#endif
#endif /* ETERM_UTMP_H_ */

View File

@ -84,11 +84,13 @@ static const char cvs_ident[] = "$Id$";
# endif
/* don't go off end of ut_id & remember if an entry has been made */
# ifndef HAVE_UTEMPTER
# if defined(USE_SYSV_UTMP) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__)
static char ut_id[5]; /* remember if entry to utmp made */
# else
static int utmp_pos; /* BSD position of utmp-stamp */
# endif
# endif
# ifdef USE_SYSV_UTMP
@ -98,6 +100,7 @@ static int utmp_pos; /* BSD position of utmp-stamp */
# define update_wtmp updwtmpx
# else /* HAVE_UTMPX_H */
# ifndef HAVE_UTEMPTER
static void
update_wtmp(char *fname, struct utmp *putmp)
{
@ -133,12 +136,12 @@ update_wtmp(char *fname, struct utmp *putmp)
close(fd);
}
# endif /* ifndef HAVE_UTEMPTER */
# endif /* HAVE_UTMPX_H */
/* makeutent() - make a utmp entry */
# ifndef HAVE_UTEMPTER
void
makeutent(const char *pty, const char *hostname)
add_utmp_entry(const char *pty, const char *hostname, int fd)
{
struct passwd *pwent = getpwuid(my_ruid);
@ -213,11 +216,12 @@ makeutent(const char *pty, const char *hostname)
update_wtmp(WTMP_FILENAME, &utmp);
endutent(); /* close the file */
privileges(REVERT);
return;
fd = 0;
}
/* cleanutent() - remove a utmp entry */
void
cleanutent(void)
remove_utmp_entry(void)
{
# ifdef HAVE_UTMPX_H
struct utmp utmp;
@ -268,6 +272,7 @@ cleanutent(void)
privileges(REVERT);
# endif /* HAVE_UTMPX_H */
}
# endif /* ifndef HAVE_UTEMPTER */
# else /* USE_SYSV_UTMP */
/* BSD utmp support */
@ -380,11 +385,8 @@ write_utmp(struct utmp *putmp)
# endif /* __FreeBSD__ || NetBSD || BSDI */
/*
* make a utmp entry
*/
void
makeutent(const char *pty, const char *hostname)
add_utmp_entry(const char *pty, const char *hostname, int fd)
{
struct passwd *pwent = getpwuid(my_ruid);
struct utmp utmp;
@ -419,13 +421,15 @@ makeutent(const char *pty, const char *hostname)
if (write_utmp(&utmp) < 0)
ut_id[0] = '\0'; /* entry not made */
# endif
return;
fd = 0;
}
/*
* remove a utmp entry
*/
void
cleanutent(void)
remove_utmp_entry(void)
{
# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__)
logout(ut_line);

View File

@ -6,11 +6,14 @@ EXTRA_DIST = Eterm/theme.cfg.in irc/theme.cfg.in chooser/theme.cfg.in emacs/them
Eterm/Eterm-menu.cfg irc/irc-menu.cfg chooser/chooser-menu.cfg emacs/emacs-menu.cfg mutt/mutt-menu.cfg trans/trans-menu.cfg \
cEterm/cEterm-menu.cfg cEterm/theme.cfg.in auto/auto-menu.cfg auto/theme.cfg.in
install-data-hook:
all: Makefile
-@for i in $(THEMES) ; do \
echo "Generating theme config file for the $$i theme." ; \
$(SED) -e 's%@''PREFIX''@%${prefix}%g' -e 's%@''PKGDATADIR''@%${DESTDIR}${pkgdatadir}%g' -e 's%@''THEME''@%'$$i'%g' \
$(srcdir)/$$i/theme.cfg.in > $(srcdir)/$$i/theme.cfg ; \
done
install-data-hook:
$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/themes
-@for i in $(THEMES) ; do \
if test ! -d $(DESTDIR)$(pkgdatadir)/themes/$$i ; then \