diff options
-rw-r--r-- | Makefile.am | 12 | ||||
-rw-r--r-- | filenames.sed.c | 21 | ||||
-rw-r--r-- | sessreg.c | 86 | ||||
-rw-r--r-- | sessreg.h | 121 | ||||
-rw-r--r-- | sessreg.man | 23 |
5 files changed, 164 insertions, 99 deletions
diff --git a/Makefile.am b/Makefile.am index e96b0d3..f33a11a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,6 +23,7 @@ bin_PROGRAMS = sessreg sessreg_CFLAGS = $(SESSREG_CFLAGS) sessreg_SOURCES = \ + sessreg.h \ sessreg.c appman_PRE = sessreg.man @@ -31,8 +32,8 @@ appmandir = $(APP_MAN_DIR) appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@) -EXTRA_DIST = $(appman_PRE) -CLEANFILES = $(appman_DATA) +EXTRA_DIST = $(appman_PRE) filenames.sed.c +CLEANFILES = $(appman_DATA) filenames.sed SED = sed @@ -40,7 +41,7 @@ SED = sed XORGRELSTRING = @PACKAGE_STRING@ XORGMANNAME = X Version 11 -MAN_SUBSTS = \ +MAN_SUBSTS = -f filenames.sed \ -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \ -e 's|__xorgversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \ -e 's|__xservername__|Xorg|g' \ @@ -57,3 +58,8 @@ SUFFIXES = .$(APP_MAN_SUFFIX) .man .man.$(APP_MAN_SUFFIX): sed $(MAN_SUBSTS) < $< > $@ + +sessreg.$(APP_MAN_SUFFIX): filenames.sed + +filenames.sed: filenames.sed.c + $(CPP) $(DEFS) $(srcdir)/filenames.sed.c | grep 's\|__' > $@ diff --git a/filenames.sed.c b/filenames.sed.c new file mode 100644 index 0000000..9ce1dcd --- /dev/null +++ b/filenames.sed.c @@ -0,0 +1,21 @@ +#include "sessreg.h" + +#ifdef UTMPX_FILE +# define UTF UTMPX_FILE +#else +# define UTF UTMP_FILE +#endif + +#ifdef WTMPX_FILE +# define WTF WTMPX_FILE +#else +# define WTF WTMP_FILE +#endif + +#ifndef TTYS_FILE +# define TTYS_FILE "/etc/ttys" +#endif + +s|__utmp_file__|UTF|g +s|__wtmp_file__|WTF|g +s|__ttys_file__|TTYS_FILE|g @@ -1,7 +1,4 @@ /* - * $Xorg: sessreg.c,v 1.5 2000/08/17 19:54:15 cpqbld Exp $ - * $XdotOrg: $ - * * Copyright 1990, 1998 The Open Group * * Permission to use, copy, modify, distribute, and sell this software and its @@ -62,8 +59,6 @@ * by Andreas Stolcke <stolcke@icsi.berkeley.edu> */ -/* $XFree86: xc/programs/xdm/sessreg.c,v 3.18 2001/12/14 20:01:24 dawes Exp $ */ - /* * sessreg * @@ -79,9 +74,7 @@ * one of -a or -d must be specified */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif +#include "sessreg.h" # include <X11/Xos.h> # include <X11/Xfuncs.h> @@ -89,83 +82,8 @@ # include <stdlib.h> # include <utmp.h> -#ifndef HAVE_CONFIG_H /* Imake fallback - hardcode platforms with utmpx */ -# if (defined(sun) && defined (__SVR4)) -# define HAVE_UTMPX_H -# define HAVE_UTMPX_UT_SYSLEN 1 -# endif -#endif - -#ifdef HAVE_UTMPX_H -# if HAVE_UTMPX_UT_SYSLEN -# include <utmpx.h> -# define USE_UTMPX -# endif -#endif - -#ifdef HAVE_CONFIG_H -# ifndef HAVE_LASTLOG_H -# define NO_LASTLOG -# endif -#else /* Imake */ -# if defined(SYSV) || (defined(SVR4) && !defined(sun)) || defined(Lynx) || defined(__QNX__) || defined(__DARWIN__) || defined(_SEQUENT_) -# define NO_LASTLOG -# endif -#endif - -#if defined(CSRG_BASED) || defined(HAVE_SYS_PARAM_H) -#include <sys/param.h> -#endif - -#ifndef NO_LASTLOG -# ifdef CSRG_BASED -# if (BSD < 199103) -# include <lastlog.h> -# endif -# else -# include <lastlog.h> -# endif -# include <pwd.h> -#endif - #if defined(__SVR4) || defined(SVR4) || defined(linux) || defined(__GLIBC__) -#define SYSV -#endif - -#ifdef CSRG_BASED -#if !defined(__FreeBSD__) && !defined(__OpenBSD__) -/* *BSD doesn't like a ':0' type entry in utmp */ -#define NO_UTMP -#endif -#endif - -#ifndef WTMP_FILE -# ifdef _PATH_WTMP -# define WTMP_FILE _PATH_WTMP -# else -# define WTMP_FILE "/usr/adm/wtmp" -# endif -#endif -#ifndef UTMP_FILE -# ifdef _PATH_UTMP -# define UTMP_FILE _PATH_UTMP -# else -# define UTMP_FILE "/etc/utmp" -# endif -#endif -#ifndef NO_LASTLOG -# ifndef LLOG_FILE -# ifdef _PATH_LASTLOG -# define LLOG_FILE _PATH_LASTLOG -# else -# define LLOG_FILE "/usr/adm/lastlog" -# endif -# endif -#endif -#ifndef SYSV -# ifndef TTYS_FILE -# define TTYS_FILE "/etc/ttys" -# endif +# define SYSV #endif #include <time.h> diff --git a/sessreg.h b/sessreg.h new file mode 100644 index 0000000..62484dd --- /dev/null +++ b/sessreg.h @@ -0,0 +1,121 @@ +/* + * Copyright 1990, 1998 The Open Group + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of The Open Group shall + * not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization + * from The Open Group. + * + */ + +/* Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons + * to whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT + * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL + * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Except as contained in this notice, the name of a copyright holder + * shall not be used in advertising or otherwise to promote the sale, use + * or other dealings in this Software without prior written authorization + * of the copyright holder. + */ + +#include "config.h" + +#include <utmp.h> + +#ifdef HAVE_UTMPX_H +# if HAVE_UTMPX_UT_SYSLEN +# include <utmpx.h> +# define USE_UTMPX +# endif +#endif + +#ifdef HAVE_SYS_PARAM_H +# include <sys/param.h> +#endif + +#ifndef HAVE_LASTLOG_H +# define NO_LASTLOG +#endif + +#ifndef NO_LASTLOG +# ifdef CSRG_BASED +# if (BSD < 199103) +# include <lastlog.h> +# endif +# else +# include <lastlog.h> +# endif +# include <pwd.h> +#endif + +#ifdef CSRG_BASED +#if !defined(__FreeBSD__) && !defined(__OpenBSD__) +/* *BSD doesn't like a ':0' type entry in utmp */ +#define NO_UTMP +#endif +#endif + +#ifndef WTMP_FILE +# ifdef _PATH_WTMP +# define WTMP_FILE _PATH_WTMP +# else +# define WTMP_FILE "/usr/adm/wtmp" +# endif +#endif +#ifndef UTMP_FILE +# ifdef _PATH_UTMP +# define UTMP_FILE _PATH_UTMP +# else +# define UTMP_FILE "/etc/utmp" +# endif +#endif +#ifndef NO_LASTLOG +# ifndef LLOG_FILE +# ifdef _PATH_LASTLOG +# define LLOG_FILE _PATH_LASTLOG +# else +# define LLOG_FILE "/usr/adm/lastlog" +# endif +# endif +#endif +#ifndef SYSV +# ifndef TTYS_FILE +# define TTYS_FILE "/etc/ttys" +# endif +#endif + diff --git a/sessreg.man b/sessreg.man index cd2e80f..b288f13 100644 --- a/sessreg.man +++ b/sessreg.man @@ -45,18 +45,18 @@ sessreg \- manage utmp/wtmp entries for non-init clients \fISessreg\fP is a simple program for managing utmp/wtmp entries for xdm sessions. .PP -System V has a better interface to /etc/utmp than BSD; it +System V has a better interface to utmp than BSD; it dynamically allocates entries in the file, instead of writing them at fixed -positions indexed by position in /etc/ttys. +positions indexed by position in __ttys_file__. .PP To manage BSD-style utmp files, \fIsessreg\fP has two strategies. In -conjunction with xdm, the -x option counts the number of lines in /etc/ttys +conjunction with xdm, the -x option counts the number of lines in __ttys_file__ and then adds to that the number of the line in the Xservers file which specifies the display. The display name must be specified as the "line-name" using the -l option. This sum is used as the "slot-number" in -/etc/utmp that this entry will be written at. In the more general case, the --s option specifies the slot-number directly. If for some strange reason -your system uses a file other that /etc/ttys to manage init, the -t option +the utmp file that this entry will be written at. In the more general case, +the -s option specifies the slot-number directly. If for some strange reason +your system uses a file other that __ttys_file__ to manage init, the -t option can direct \fIsessreg\fP to look elsewhere for a count of terminal sessions. .PP @@ -83,12 +83,11 @@ and in Xreset: .fi .SH OPTIONS .IP "\fB-w\fP \fIwtmp-file\fP" -This specifies an alternate wtmp file, instead of /usr/adm/wtmp for BSD or -/etc/wtmp for sysV. The special name "none" disables writing records to -/usr/adm/wtmp. +This specifies an alternate wtmp file, instead of __wtmp_file__. +The special name "none" disables writing records to the wtmp file. .IP "\fB-u\fP \fIutmp-file\fP" -This specifies an alternate utmp file, instead of "/etc/utmp". The special -name "none" disables writing records to /etc/utmp. +This specifies an alternate utmp file, instead of __utmp_file__. +The special name "none" disables writing records to the utmp file. .IP "\fB-l\fP \fIline-name\fP" This describes the "line" name of the entry. For terminal sessions, this is the final pathname segment of the terminal device filename @@ -101,7 +100,7 @@ This is set for BSD hosts to indicate that the session was initiated from a remote host. In typical xdm usage, this options is not used. .IP "\fB-s\fP \fIslot-number\fP" Each potential session has a unique slot number in BSD systems, most are -identified by the position of the \fIline-name\fP in the /etc/ttys file. +identified by the position of the \fIline-name\fP in the __ttys_file__ file. This option overrides the default position determined with ttyslot(3). This option is inappropriate for use with xdm, the -x option is more useful. .IP "\fB-x\fP \fIXservers-file\fP" |