summaryrefslogtreecommitdiffstats
path: root/libexec/rpc.rusersd
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>1997-11-26 07:36:51 +0000
committercharnier <charnier@FreeBSD.org>1997-11-26 07:36:51 +0000
commit2053d9365e1089751c84f7763a4d82499a28cbb9 (patch)
tree0857708558ce92f33cbeec2df4da7d1ceada2eec /libexec/rpc.rusersd
parenta1752dee71c9d0ef623d348bcbdb0dc83e3bbf65 (diff)
downloadFreeBSD-src-2053d9365e1089751c84f7763a4d82499a28cbb9.zip
FreeBSD-src-2053d9365e1089751c84f7763a4d82499a28cbb9.tar.gz
Use err(3). -Wall cleaning. cosmetics in man page.
Diffstat (limited to 'libexec/rpc.rusersd')
-rw-r--r--libexec/rpc.rusersd/rpc.rusersd.812
-rw-r--r--libexec/rpc.rusersd/rusers_proc.c29
-rw-r--r--libexec/rpc.rusersd/rusersd.c12
3 files changed, 30 insertions, 23 deletions
diff --git a/libexec/rpc.rusersd/rpc.rusersd.8 b/libexec/rpc.rusersd/rpc.rusersd.8
index 81345f8..c303eef 100644
--- a/libexec/rpc.rusersd/rpc.rusersd.8
+++ b/libexec/rpc.rusersd/rpc.rusersd.8
@@ -31,7 +31,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id$
+.\" $Id: rpc.rusersd.8,v 1.4 1997/02/22 14:22:16 peter Exp $
.\"
.Dd June 7, 1993
.Dt RPC.RUSERSD 8
@@ -42,7 +42,7 @@
.Sh SYNOPSIS
.Nm /usr/libexec/rpc.rusersd
.Sh DESCRIPTION
-.Nm rpc.rusersd
+.Nm Rpc.rusersd
is a server which returns information about users
currently logged in to the system.
.Pp
@@ -50,12 +50,14 @@ The currently logged in users are queried using the
.Xr rusers 1
command.
The
-.Nm rpc.rusersd
+.Nm
daemon is normally invoked by
.Xr inetd 8 .
.Pp
-.Nm rpc.rusersd
-uses an RPC protocol defined in
+.Nm Rpc.rusersd
+uses an
+.Tn RPC
+protocol defined in
.Pa /usr/include/rpcsvc/rnusers.x .
.Sh SEE ALSO
.Xr rusers 1 ,
diff --git a/libexec/rpc.rusersd/rusers_proc.c b/libexec/rpc.rusersd/rusers_proc.c
index db6288b..c8c217c 100644
--- a/libexec/rpc.rusersd/rusers_proc.c
+++ b/libexec/rpc.rusersd/rusers_proc.c
@@ -32,19 +32,22 @@
*/
#ifndef lint
-static char rcsid[] = "$Id$";
+static const char rcsid[] =
+ "$Id$";
#endif /* not lint */
+#include <err.h>
+#include <rpc/rpc.h>
#include <signal.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <utmp.h>
#include <stdio.h>
-#include <syslog.h>
-#include <rpc/rpc.h>
-#include <sys/socket.h>
+#include <string.h>
#include <sys/param.h>
+#include <sys/socket.h>
#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <syslog.h>
+#include <utmp.h>
#ifdef XIDLE
#include <setjmp.h>
#include <X11/Xlib.h>
@@ -117,18 +120,18 @@ XqueryIdle(char *display)
}
if (XidleQueryExtension(dpy, &first_event, &first_error)) {
if (!XGetIdleTime(dpy, &IdleTime)) {
- syslog(LOG_ERR, "%s: Unable to get idle time.", display);
+ syslog(LOG_ERR, "%s: unable to get idle time", display);
return(-1);
}
}
else {
- syslog(LOG_ERR, "%s: Xidle extension not loaded.", display);
+ syslog(LOG_ERR, "%s: Xidle extension not loaded", display);
return(-1);
}
XCloseDisplay(dpy);
}
else {
- syslog(LOG_ERR, "%s: Server grabbed for over 10 seconds.", display);
+ syslog(LOG_ERR, "%s: server grabbed for over 10 seconds", display);
return(-1);
}
(void) signal (SIGALRM, SIG_DFL);
@@ -380,10 +383,8 @@ rusers_service(rqstp, transp)
if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
svcerr_systemerr(transp);
}
- if (!svc_freeargs(transp, xdr_argument, &argument)) {
- (void)fprintf(stderr, "unable to free arguments\n");
- exit(1);
- }
+ if (!svc_freeargs(transp, xdr_argument, &argument))
+ errx(1, "unable to free arguments");
leave:
if (from_inetd)
exit(0);
diff --git a/libexec/rpc.rusersd/rusersd.c b/libexec/rpc.rusersd/rusersd.c
index 8538797..5cc4faf 100644
--- a/libexec/rpc.rusersd/rusersd.c
+++ b/libexec/rpc.rusersd/rusersd.c
@@ -32,11 +32,14 @@
*/
#ifndef lint
-static char rcsid[] = "$Id$";
+static const char rcsid[] =
+ "$Id$";
#endif /* not lint */
#include <stdio.h>
+#include <stdlib.h>
#include <rpc/rpc.h>
+#include <rpc/pmap_clnt.h>
#include <signal.h>
#include <syslog.h>
#define utmp rutmp
@@ -55,6 +58,7 @@ cleanup()
exit(0);
}
+int
main(argc, argv)
int argc;
char *argv[];
@@ -90,16 +94,16 @@ main(argc, argv)
transp = svcudp_create(sock);
if (transp == NULL) {
- syslog(LOG_ERR, "cannot create udp service.");
+ syslog(LOG_ERR, "cannot create udp service");
exit(1);
}
if (!svc_register(transp, RUSERSPROG, RUSERSVERS_IDLE, rusers_service, proto)) {
- syslog(LOG_ERR, "unable to register (RUSERSPROG, RUSERSVERS_IDLE, %s).", proto?"udp":"(inetd)");
+ syslog(LOG_ERR, "unable to register (RUSERSPROG, RUSERSVERS_IDLE, %s)", proto?"udp":"(inetd)");
exit(1);
}
if (!svc_register(transp, RUSERSPROG, RUSERSVERS_ORIG, rusers_service, proto)) {
- syslog(LOG_ERR, "unable to register (RUSERSPROG, RUSERSVERS_ORIG, %s).", proto?"udp":"(inetd)");
+ syslog(LOG_ERR, "unable to register (RUSERSPROG, RUSERSVERS_ORIG, %s)", proto?"udp":"(inetd)");
exit(1);
}
OpenPOWER on IntegriCloud