From ac16f380e349fa39ec7e26bccb5456cb300006a5 Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Sun, 14 Sep 1997 17:50:06 +0000 Subject: Pull in sources from zephyr locker. See /mit/zephyr/repository for detailed change information. --- clients/zwrite/Imakefile | 15 ----------- clients/zwrite/Makefile.in | 47 ++++++++++++++++++++++++++++++++ clients/zwrite/zwrite.1 | 3 +++ clients/zwrite/zwrite.c | 67 ++++++++++++++++++++++++++++++---------------- 4 files changed, 94 insertions(+), 38 deletions(-) delete mode 100644 clients/zwrite/Imakefile create mode 100644 clients/zwrite/Makefile.in (limited to 'clients/zwrite') diff --git a/clients/zwrite/Imakefile b/clients/zwrite/Imakefile deleted file mode 100644 index b07be96..0000000 --- a/clients/zwrite/Imakefile +++ /dev/null @@ -1,15 +0,0 @@ -/**/# Copyright 1988 Massachusetts Institute of Technology. -/**/# -/**/# For copying and distribution information, see the file -/**/# "mit-copyright.h". -/**/# -/**/# $Source$ -/**/# $Author$ -/**/# $Id$ -/**/# - -SRCS = zwrite.c -OBJS = zwrite.o - -zprogram(zwrite,) -install_man(zwrite.1,zwrite.1) diff --git a/clients/zwrite/Makefile.in b/clients/zwrite/Makefile.in new file mode 100644 index 0000000..9319c24 --- /dev/null +++ b/clients/zwrite/Makefile.in @@ -0,0 +1,47 @@ +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@ + +DEBUG=-O +CFLAGS=${DEBUG} -I${top_srcdir}/h -I${BUILDTOP}/h @CPPFLAGS@ +LDFLAGS=${DEBUG} -L${BUILDTOP}/lib/zephyr @ET_LDFLAGS@ @LDFLAGS@ +LIBS=-lzephyr @LIBS@ -lcom_err + +OBJS= zwrite.o + +all: zwrite + +zwrite: ${OBJS} ${BUILDTOP}/lib/zephyr/libzephyr.a @ETDEP@ + ${CC} ${LDFLAGS} -o $@ ${OBJS} ${LIBS} + +check: + +install: zwrite + ${INSTALL} -m 755 -s zwrite ${DESTDIR}${bindir} + ${INSTALL} -m 644 ${srcdir}/zwrite.1 ${DESTDIR}${mandir}/man1 + +clean: + rm -f ${OBJS} zwrite + +${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/zwrite/zwrite.1 b/clients/zwrite/zwrite.1 index 4dfe47c..dac2954 100644 --- a/clients/zwrite/zwrite.1 +++ b/clients/zwrite/zwrite.1 @@ -164,6 +164,9 @@ and recipient "*". .br This argument may not be used in conjunction with the -f option. .TP +.B \-F \fIformat\fR +Allows a user to specify a different default format for the message. +.TP .B \-O \fIopcode\fR Allows a user to specify a different opcode for the message. Some Zephyr notice display programs may use the opcode to decide how diff --git a/clients/zwrite/zwrite.c b/clients/zwrite/zwrite.c index 08d9a00..67badb3 100644 --- a/clients/zwrite/zwrite.c +++ b/clients/zwrite/zwrite.c @@ -11,16 +11,14 @@ * "mit-copyright.h". */ +#include #include - #include -#include #include #include -#include #ifndef lint -static char rcsid_zwrite_c[] = "$Id$"; +static const char rcsid_zwrite_c[] = "$Id$"; #endif /* lint */ #define DEFAULT_CLASS "MESSAGE" @@ -32,8 +30,8 @@ static char rcsid_zwrite_c[] = "$Id$"; #define MAXRECIPS 100 int nrecips, msgarg, verbose, quiet, nodot; -char *whoami, *inst, *class, *opcode, *recips[MAXRECIPS]; -int (*auth)(); +char *whoami, *inst, *class, *opcode, *realm, *recips[MAXRECIPS]; +Z_AuthProc auth; void un_tabify(); char *fix_filsrv_inst(); @@ -43,7 +41,7 @@ main(argc, argv) char *argv[]; { int retval, arg, nocheck, nchars, msgsize, filsys, tabexpand; - char *message, *signature = NULL; + char *message, *signature = NULL, *format = NULL; static char bfr[BUFSIZ], classbfr[BUFSIZ], instbfr[BUFSIZ], sigbfr[BUFSIZ]; static char opbfr[BUFSIZ]; static ZNotice_t notice; @@ -166,6 +164,18 @@ main(argc, argv) case 'l': /* literal */ nodot = 1; break; + case 'F': + if (arg == argc-1) + usage(whoami); + arg++; + format = argv[arg]; + break; + case 'r': + if (arg == argc-1) + usage(whoami); + arg++; + realm = argv[arg]; + break; default: usage(whoami); } @@ -211,7 +221,9 @@ main(argc, argv) notice.z_sender = 0; notice.z_message_len = 0; notice.z_recipient = ""; - if (filsys == 1) + if (format) + notice.z_default_format = format; + else if (filsys == 1) notice.z_default_format = "@bold(Filesystem Operation Message for $instance:)\nFrom: @bold($sender) at $time $date\n$message"; else if (auth == ZAUTH) { if (signature) @@ -307,13 +319,18 @@ send_off(notice, real) int real; { int i, success, retval; - char bfr[BUFSIZ]; + char bfr[BUFSIZ], realm_recip[BUFSIZ], *cp; ZNotice_t retnotice; success = 0; for (i=0;iz_recipient = nrecips?recips[i]:""; + if (realm) { + sprintf(realm_recip, "%s@%s", (nrecips) ? recips[i] : "", realm); + notice->z_recipient = realm_recip; + } else { + notice->z_recipient = (nrecips) ? recips[i] : ""; + } if (verbose && real) printf("Sending %smessage, class %s, instance %s, to %s\n", auth?"authenticated ":"", @@ -362,23 +379,27 @@ send_off(notice, real) } } else if (!strcmp(retnotice.z_message, ZSRVACK_NOTSENT)) { if (verbose && real && !quiet) { - if (strcmp(class, DEFAULT_CLASS)) - printf("Not logged in or not subscribing to class %s, instance %s\n", + if (strcmp(class, DEFAULT_CLASS)) { + fprintf(stderr, "Not logged in or not subscribing to class %s, instance %s\n", class, inst); - else - printf("Not logged in or not subscribing to messages\n"); + } else { + fprintf(stderr, + "Not logged in or not subscribing to messages\n"); + } } else if (!quiet) { - if (!nrecips) - printf("No one subscribing to class %s, instance %s\n", - class, inst); - else { - if (strcmp(class, DEFAULT_CLASS)) - printf("%s: Not logged in or not subscribing to class %s, instance %s\n", + if (!nrecips) { + fprintf(stderr, + "No one subscribing to class %s, instance %s\n", + class, inst); + } else { + if (strcmp(class, DEFAULT_CLASS)) { + fprintf(stderr, "%s: Not logged in or not subscribing to class %s, instance %s\n", notice->z_recipient, class, inst); - else - printf("%s: Not logged in or not subscribing to messages\n", + } else { + fprintf(stderr, "%s: Not logged in or not subscribing to messages\n", notice->z_recipient); + } } } } @@ -398,7 +419,7 @@ usage(s) fprintf(stderr, "Usage: %s [-a] [-o] [-d] [-v] [-q] [-n] [-t] [-u] [-l]\n\ \t[-c class] [-i inst] [-O opcode] [-f fsname] [-s signature]\n\ -\t[user ...] [-m message]\n", s); +\t[user ...] [-F format] [-r realm] [-m message]\n", s); fprintf(stderr,"\t-f and -c are mutually exclusive\n\ \t-f and -i are mutually exclusive\n\ \trecipients must be specified unless -c or -f specifies a class\n\ -- cgit v1.2.3