summaryrefslogtreecommitdiff
path: root/clients/zctl
diff options
context:
space:
mode:
authorGravatar Greg Hudson <ghudson@mit.edu>1997-09-14 17:50:06 +0000
committerGravatar Greg Hudson <ghudson@mit.edu>1997-09-14 17:50:06 +0000
commitac16f380e349fa39ec7e26bccb5456cb300006a5 (patch)
treec07ca88af97b4f6b77d28a2dc723d2e4621ed302 /clients/zctl
parentd33e482744fad80d95cdd89ed380c5b8401e49bf (diff)
Pull in sources from zephyr locker. See /mit/zephyr/repository for
detailed change information.
Diffstat (limited to 'clients/zctl')
-rw-r--r--clients/zctl/Imakefile16
-rw-r--r--clients/zctl/Makefile.in61
-rw-r--r--clients/zctl/zctl.19
-rw-r--r--clients/zctl/zctl.c51
-rw-r--r--clients/zctl/zctl_cmds.ct3
5 files changed, 99 insertions, 41 deletions
diff --git a/clients/zctl/Imakefile b/clients/zctl/Imakefile
deleted file mode 100644
index 69418d6..0000000
--- a/clients/zctl/Imakefile
+++ /dev/null
@@ -1,16 +0,0 @@
-/**/# Copyright 1988 Massachusetts Institute of Technology.
-/**/#
-/**/# For copying and distribution information, see the file
-/**/# "mit-copyright.h".
-/**/#
-/**/# $Source$
-/**/# $Author$
-/**/# $Id$
-/**/#
-
-SRCS = zctl.c zctl_cmds.c
-OBJS = zctl.o zctl_cmds.o
-
-cmd_table(zctl_cmds)
-zprogram(zctl,$(LIB_SS))
-install_man(zctl.1,zctl.1)
diff --git a/clients/zctl/Makefile.in b/clients/zctl/Makefile.in
new file mode 100644
index 0000000..c9fb8d0
--- /dev/null
+++ b/clients/zctl/Makefile.in
@@ -0,0 +1,61 @@
+SHELL = /bin/sh
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+datadir=@datadir@
+confdir=@confdir@
+sbindir=@sbindir@
+lsbindir=@lsbindir@
+
+includedir=${prefix}/include
+mandir=${prefix}/man
+libdir=${exec_prefix}/lib
+bindir=${exec_prefix}/bin
+
+srcdir=@srcdir@
+top_srcdir=@top_srcdir@
+BUILDTOP=../..
+VPATH=@srcdir@
+CC=@CC@
+INSTALL=@INSTALL@
+MK_CMDS=@MK_CMDS@
+
+DEBUG=-O
+CFLAGS=${DEBUG} -I${top_srcdir}/h -I${BUILDTOP}/h @X_CFLAGS@ @CPPFLAGS@
+LDFLAGS=${DEBUG} -L${BUILDTOP}/lib/zephyr @ET_LDFLAGS@ @SS_LDFLAGS@ @LDFLAGS@
+LIBS=-lzephyr -lss @LIBS@ -lcom_err
+
+OBJS= zctl.o zctl_cmds.o
+
+all: zctl
+
+zctl: ${OBJS} ${BUILDTOP}/lib/zephyr/libzephyr.a @ETDEP@ @SSDEP@
+ ${CC} ${LDFLAGS} -o $@ ${OBJS} ${LIBS}
+
+# The Athena mk_cmds insists on writing output to source directory. Bleah.
+# After the patch to fix it goes into an Athena release, replace it with:
+# ${MK_CMDS} ${srcdir}/zctl_cmds.ct
+zctl_cmds.c: zctl_cmds.ct
+ cp ${srcdir}/zctl_cmds.ct /tmp/zctl_cmds.$$$$.ct; \
+ ${MK_CMDS} /tmp/zctl_cmds.$$$$.ct; \
+ if [ -f /tmp/zctl_cmds.$$$$.c ]; then \
+ mv /tmp/zctl_cmds.$$$$.c zctl_cmds.c; \
+ else \
+ mv zctl_cmds.$$$$.c zctl_cmds.c; \
+ fi; \
+ rm -f /tmp/zctl_cmds.$$$$.ct
+
+check:
+
+install: zctl
+ ${INSTALL} -m 755 -s zctl ${DESTDIR}${bindir}
+ ${INSTALL} -m 644 ${srcdir}/zctl.1 ${DESTDIR}${mandir}/man1
+
+clean:
+ rm -f ${OBJS} zctl_cmds.c zctl
+
+${OBJS}: ${top_srcdir}/h/sysdep.h ${BUILDTOP}/h/config.h
+${OBJS}: ${BUILDTOP}/h/zephyr/zephyr.h ${BUILDTOP}/h/zephyr/zephyr_err.h
+
+.PHONY: all check install clean
+
diff --git a/clients/zctl/zctl.1 b/clients/zctl/zctl.1
index 4608dab..6b6e4c0 100644
--- a/clients/zctl/zctl.1
+++ b/clients/zctl/zctl.1
@@ -153,6 +153,11 @@ Delete the definitions of the specified Zephyr variables.
Unsubscribe to \fIclass, instance, recipient\fR, but don't remove this triplet
from the subscriptions file.
.TP
+.B wg_exit
+Tell the WindowGram client,
+.I zwgc(1),
+to exit.
+.TP
.B wg_read
Tell the WindowGram client,
.I zwgc(1),
@@ -269,10 +274,6 @@ Save all current subscriptions to the default subscriptions file.
.TP
.B zctl set exposure none
Set your exposure level to `none', effectively turning off Zephyr.
-.SH BUGS
-The current implementation of the Zephyr server (\fIzephyrd(8)\fR) makes
-no distinction between realm-announced, net-visible and net-announced
-exposure levels.
.SH SEE ALSO
zephyr(1), zwgc(1), zhm(8), zephyrd(8)
gethostbyname(3)
diff --git a/clients/zctl/zctl.c b/clients/zctl/zctl.c
index 3516680..e8aa1cb 100644
--- a/clients/zctl/zctl.c
+++ b/clients/zctl/zctl.c
@@ -11,19 +11,14 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
#include <zephyr/zephyr.h>
#include <ss/ss.h>
#include <com_err.h>
#include <pwd.h>
#include <netdb.h>
-#include <string.h>
-#include <sys/file.h>
-#include <sys/param.h>
-#ifdef POSIX
-#include <sys/utsname.h>
-#endif
#ifndef lint
-static char *rcsid_zctl_c = "$Id$";
+static const char *rcsid_zctl_c = "$Id$";
#endif
#define SUBSATONCE 7
@@ -60,9 +55,9 @@ main(argc,argv)
{
struct passwd *pwd;
struct hostent *hent;
- char ssline[BUFSIZ],oldsubsname[BUFSIZ],*envptr;
+ char ssline[BUFSIZ],oldsubsname[BUFSIZ],*envptr,*tty = NULL;
int retval,code,i;
-#ifdef POSIX
+#ifdef HAVE_SYS_UTSNAME
struct utsname name;
#endif
@@ -71,20 +66,28 @@ main(argc,argv)
exit (1);
}
- envptr = (char *)getenv("HOME");
+ /* Set hostname and tty for locations. If we support X, use the
+ * DISPLAY environment variable for the tty name. */
+#ifndef X_DISPLAY_MISSING
+ tty = getenv("DISPLAY");
+#endif
+ if ((retval = ZInitLocationInfo(NULL, tty)) != ZERR_NONE)
+ com_err(argv[0], retval, "initializing location information");
+
+ envptr = getenv("HOME");
if (envptr)
- (void) strcpy(subsname,envptr);
+ strcpy(subsname,envptr);
else {
if (!(pwd = getpwuid((int) getuid()))) {
fprintf(stderr,"Who are you?\n");
exit (1);
}
- (void) strcpy(subsname,pwd->pw_dir);
+ strcpy(subsname,pwd->pw_dir);
}
- (void) strcpy(oldsubsname,subsname);
- (void) strcat(oldsubsname,OLD_SUBS);
- (void) strcat(subsname,USERS_SUBS);
+ strcpy(oldsubsname,subsname);
+ strcat(oldsubsname,OLD_SUBS);
+ strcat(subsname,USERS_SUBS);
if (!access(oldsubsname,F_OK) && access(subsname, F_OK)) {
/* only if old one exists and new one does not exist */
printf("The .subscriptions file in your home directory is now being used as\n.zephyr.subs . I will rename it to .zephyr.subs for you.\n");
@@ -92,7 +95,7 @@ main(argc,argv)
com_err(argv[0], errno, "renaming .subscriptions");
}
-#ifdef POSIX
+#ifdef HAVE_SYS_UTSNAME
uname(&name);
strcpy(ourhost, name.nodename);
#else
@@ -205,6 +208,8 @@ wgc_control(argc,argv)
notice.z_opcode = USER_SHUTDOWN;
if (!strcmp(argv[0],"wg_startup"))
notice.z_opcode = USER_STARTUP;
+ if (!strcmp(argv[0],"wg_exit"))
+ notice.z_opcode = USER_EXIT;
if (!notice.z_opcode) {
fprintf(stderr,
"unknown WindowGram client control command %s\n",
@@ -371,10 +376,15 @@ do_hide(argc,argv)
fprintf(stderr, "Usage: %s\n",argv[0]);
return;
}
- if (!strcmp(argv[0],"unhide"))
- exp_level = EXPOSE_REALMVIS;
- else
+ if (!strcmp(argv[0],"unhide")) {
+ exp_level = ZGetVariable("exposure");
+ if (exp_level)
+ exp_level = ZParseExposureLevel(exp_level);
+ if (!exp_level)
+ exp_level = EXPOSE_NONE;
+ } else {
exp_level = EXPOSE_OPSTAFF;
+ }
if ((retval = ZSetLocation(exp_level)) != ZERR_NONE)
ss_perror(sci_idx,retval,"while changing exposure status");
return;
@@ -473,8 +483,7 @@ sub_file(argc,argv)
}
sub.zsub_class = argv[1];
sub.zsub_classinst = argv[2];
- sub.zsub_recipient = (argc == 3)?TOKEN_ME:TOKEN_WILD;
-
+ sub.zsub_recipient = (argc == 3)?TOKEN_ME:argv[3];
if (make_exist(subsname))
return;
diff --git a/clients/zctl/zctl_cmds.ct b/clients/zctl/zctl_cmds.ct
index fe39283..363ca66 100644
--- a/clients/zctl/zctl_cmds.ct
+++ b/clients/zctl/zctl_cmds.ct
@@ -63,6 +63,9 @@
request wgc_control, "Tell the WindowGram to react to incoming notices.",
wg_startup;
+ request wgc_control, "Tell the WindowGram to exit completely.",
+ wg_exit;
+
request hm_control, "Tell the server to flush information about this host.",
hm_flush;