mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-13 11:42:21 +00:00
DtTerm: Add libutempter support for utmp/wtmp updates.
This commit is contained in:
parent
82d4a8bb68
commit
ba1c6bf810
4 changed files with 31 additions and 3 deletions
|
@ -53,7 +53,6 @@ TERMPRIM_OBJS = \
|
|||
TermPrim/TermPrimScroll.o \
|
||||
TermPrim/TermPrimSelect.o \
|
||||
TermPrim/TermPrimSetPty.o \
|
||||
TermPrim/TermPrimSetUtmp.o \
|
||||
TermPrim/TermPrimSubproc.o \
|
||||
TermPrim/TermPrimUtil.o \
|
||||
TermPrim/TermPrimVersion.o \
|
||||
|
@ -78,6 +77,12 @@ TERMVIEW_OBJS = \
|
|||
TermView/TermViewGlobalDialog.o \
|
||||
TermView/TermViewTerminalDialog.o
|
||||
|
||||
#if defined(HasUtempterLibrary) && HasUtempterLibrary
|
||||
REQUIREDLIBS += -lutempter
|
||||
#else
|
||||
TERMPRIM_OBJS += TermPrim/TermPrimSetUtmp.o
|
||||
#endif
|
||||
|
||||
OBJS = \
|
||||
$(TERMPRIM_OBJS) \
|
||||
$(TERM_OBJS) \
|
||||
|
|
|
@ -40,7 +40,6 @@ SRCS = \
|
|||
TermPrimScroll.c \
|
||||
TermPrimSelect.c \
|
||||
TermPrimSetPty.c \
|
||||
TermPrimSetUtmp.c \
|
||||
TermPrimSubproc.c \
|
||||
TermPrimUtil.c \
|
||||
TermPrimVersion.c \
|
||||
|
@ -69,12 +68,18 @@ OBJS = \
|
|||
TermPrimScroll.o \
|
||||
TermPrimSelect.o \
|
||||
TermPrimSetPty.o \
|
||||
TermPrimSetUtmp.o \
|
||||
TermPrimSubproc.o \
|
||||
TermPrimUtil.o \
|
||||
TermPrimVersion.o \
|
||||
TermPrimWMProtocols.o
|
||||
|
||||
#if defined(HasUtempterLibrary) && HasUtempterLibrary
|
||||
EXTRA_DEFINES = -DHAS_UTEMPTER_LIBRARY
|
||||
#else
|
||||
SRCS += TermPrimSetUtmp.c
|
||||
OBJS += TermPrimSetUtmp.o
|
||||
#endif
|
||||
|
||||
#include <Library.tmpl>
|
||||
|
||||
#if defined(HasPtsDriver) && HasPtsDriver
|
||||
|
|
|
@ -82,6 +82,10 @@ extern char * _DtTermPrimGetMessage( char *filename, int set, int n, char *s );
|
|||
# include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAS_UTEMPTER_LIBRARY
|
||||
#include <utempter.h>
|
||||
#endif
|
||||
|
||||
extern void TermReadKey(Widget w, XEvent *event, String *params,
|
||||
Cardinal *num_params);
|
||||
static void ClassInitialize(void);
|
||||
|
@ -1068,7 +1072,9 @@ Initialize(Widget ref_w, Widget w, Arg *args, Cardinal *num_args)
|
|||
/*
|
||||
** Initialize the utmp stuff...
|
||||
*/
|
||||
#ifndef HAS_UTEMPTER_LIBRARY
|
||||
_DtTermPrimUtmpInit(w);
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Initialize the selection inforamtion
|
||||
|
@ -2478,8 +2484,12 @@ Realize(Widget w, XtValueMask *p_valueMask, XSetWindowAttributes *attributes)
|
|||
|
||||
/* get the utmp line name to use for searching later... */
|
||||
if (tw->term.pty >= 0) {
|
||||
#ifdef HAS_UTEMPTER_LIBRARY
|
||||
utempter_add_record(tw->term.pty, DisplayString(XtDisplay(w)));
|
||||
#else
|
||||
tw->term.tpd->utmpId = _DtTermPrimUtmpGetUtLine(-1,
|
||||
tw->term.ptySlaveName);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2620,11 +2630,15 @@ Destroy(Widget w)
|
|||
_DtTermPrimToggleSuidRoot(False);
|
||||
|
||||
/* clean up our utmp entry... */
|
||||
#ifdef HAS_UTEMPTER_LIBRARY
|
||||
utempter_remove_added_record();
|
||||
#else
|
||||
if (tw->term.tpd && tw->term.tpd->utmpId && *tw->term.tpd->utmpId) {
|
||||
_DtTermPrimUtmpEntryDestroy(w, tw->term.tpd->utmpId);
|
||||
(void) XtFree(tw->term.tpd->utmpId);
|
||||
tw->term.tpd->utmpId = (char *) 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* close and release the...
|
||||
*/
|
||||
|
|
|
@ -573,8 +573,10 @@ _DtTermPrimSubprocExec(Widget w,
|
|||
}
|
||||
|
||||
/* set our utmp entry... */
|
||||
#ifndef HAS_UTEMPTER_LIBRARY
|
||||
(void) _DtTermPrimUtmpEntryCreate(w, getpid(),
|
||||
((DtTermPrimitiveWidget)w)->term.tpd->utmpId);
|
||||
#endif
|
||||
|
||||
if (isDebugSet('T')) {
|
||||
#ifdef BBA
|
||||
|
@ -652,7 +654,9 @@ _DtTermPrimSubprocExec(Widget w,
|
|||
/* assume that our child set up a utmp entry (since we have no way
|
||||
* for it to report to us) and add it to the list to cleanup)...
|
||||
*/
|
||||
#ifndef HAS_UTEMPTER_LIBRARY
|
||||
_DtTermPrimUtmpAddEntry(((DtTermPrimitiveWidget)w)->term.tpd->utmpId);
|
||||
#endif
|
||||
|
||||
return(pid);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue