diff options
author | Dan Winship <danw@mit.edu> | 1999-03-10 23:21:53 +0000 |
---|---|---|
committer | Dan Winship <danw@mit.edu> | 1999-03-10 23:21:53 +0000 |
commit | b86afecfe7fdedcce826470ab349b54a36e24728 (patch) | |
tree | d4b51f0d1e72d06c851dfba4f66afb94c7e6e74e /clients/zwrite | |
parent | 53e23ce3319763c69fd6174239f655d5210e8a58 (diff) |
gratuitous automatic CC-adding flag for multiple-recipient zephyrs
Diffstat (limited to 'clients/zwrite')
-rw-r--r-- | clients/zwrite/zwrite.1 | 10 | ||||
-rw-r--r-- | clients/zwrite/zwrite.c | 27 |
2 files changed, 35 insertions, 2 deletions
diff --git a/clients/zwrite/zwrite.1 b/clients/zwrite/zwrite.1 index 900d28c..64453af 100644 --- a/clients/zwrite/zwrite.1 +++ b/clients/zwrite/zwrite.1 @@ -30,6 +30,8 @@ zwrite \- write to another user via Zephyr ] [ .BI -l ] [ +.BI -C +] [ .BI -O opcode ] [ .BI -s @@ -128,6 +130,14 @@ When the .B \-m option is used, no PING is sent. .TP +.B \-C +prepends a "CC:" line to the body of the message indicating the +recipients of the message. This is strictly a convenience: the +presence of a "CC:" line at the top of a zephyr body does not +necessarily indicate that this option was used, or that the message +really was sent to the listed users, and its lack doesn't indicate +that the message was not sent to multiple users. +.TP .B \-s \fIsignature\fR sets the signature to be included in the message. This overrides both the user's name (as found in the password file) and any diff --git a/clients/zwrite/zwrite.c b/clients/zwrite/zwrite.c index 453706c..407b020 100644 --- a/clients/zwrite/zwrite.c +++ b/clients/zwrite/zwrite.c @@ -28,7 +28,7 @@ static const char rcsid_zwrite_c[] = "$Id$"; #define MAXRECIPS 100 -int nrecips, msgarg, verbose, quiet, nodot; +int nrecips, msgarg, verbose, quiet, nodot, cc; char *whoami, *inst, *class, *opcode, *realm, *recips[MAXRECIPS]; Z_AuthProc auth; void un_tabify(); @@ -175,6 +175,9 @@ main(argc, argv) arg++; realm = argv[arg]; break; + case 'C': + cc = 1; + break; default: usage(whoami); } @@ -256,6 +259,26 @@ main(argc, argv) message[msgsize++] = '\0'; } + if (cc && nrecips > 1) { + int size = msgsize; + for (arg=0;arg<nrecips;arg++) + size += (strlen(recips[arg]) + 2); + size += 6; /* for the newlines and "cc: " */ + message = realloc(message, (unsigned) size); + (void) strcpy(message+msgsize, "CC: "); + msgsize += 4; + for (arg=0;arg<nrecips;arg++) { + (void) strcpy(message+msgsize, recips[arg]); + msgsize += strlen(recips[arg]); + if (arg != nrecips-1) { + message[msgsize] = ' '; + msgsize++; + } + } + message[msgsize] = '\n'; + msgsize += 1; + } + if (msgarg) { int size = msgsize; for (arg=msgarg;arg<argc;arg++) @@ -417,7 +440,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[-c class] [-i inst] [-O opcode] [-f fsname] [-s signature] [-C]\n\ \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\ |