summaryrefslogtreecommitdiff
path: root/clients/zwrite
diff options
context:
space:
mode:
authorGravatar Craig Fields <cfields@mit.edu>1995-01-20 02:44:06 +0000
committerGravatar Craig Fields <cfields@mit.edu>1995-01-20 02:44:06 +0000
commit3a39665e7292158867e8b42b2f14d2fa9550275a (patch)
tree9f5888ff43f8886e733fb061583cef95ef4efbe4 /clients/zwrite
parent3bc9f87d1d3698f306a89ff320ac58510ece475f (diff)
Exit status bugfix.
Maybe more.
Diffstat (limited to 'clients/zwrite')
-rw-r--r--clients/zwrite/zwrite.c87
1 files changed, 39 insertions, 48 deletions
diff --git a/clients/zwrite/zwrite.c b/clients/zwrite/zwrite.c
index c8ca4ce..08d9a00 100644
--- a/clients/zwrite/zwrite.c
+++ b/clients/zwrite/zwrite.c
@@ -227,9 +227,6 @@ main(argc, argv)
if (!nocheck && nrecips)
send_off(&notice, 0);
- if (quiet)
- notice.z_kind = UNACKED; /* change for real sending */
-
if (!msgarg && isatty(0))
if (nodot)
printf("Type your message now. End with the end-of-file character.\n");
@@ -328,12 +325,6 @@ send_off(notice, real)
com_err(whoami, retval, bfr);
break;
}
- if (quiet && real) {
- if (nrecips)
- continue; /* next! */
- else
- break; /* no more */
- }
if ((retval = ZIfNotice(&retnotice, (struct sockaddr_in *) 0,
ZCompareUIDPred,
(char *)&notice->z_uid)) !=
@@ -345,59 +336,59 @@ send_off(notice, real)
continue;
}
if (retnotice.z_kind == SERVNAK) {
- printf("Received authorization failure while sending to %s\n",
- nrecips?notice->z_recipient:inst);
+ if (!quiet) {
+ printf("Received authorization failure while sending to %s\n",
+ nrecips?notice->z_recipient:inst);
+ }
ZFreeNotice(&retnotice);
break; /* if auth fails, punt */
}
if (retnotice.z_kind != SERVACK || !retnotice.z_message_len) {
- printf("Detected server failure while receiving acknowledgement for %s\n",
- nrecips?notice->z_recipient:inst);
+ if (!quiet) {
+ printf("Detected server failure while receiving acknowledgement for %s\n",
+ nrecips?notice->z_recipient:inst);
+ }
ZFreeNotice(&retnotice);
continue;
}
- if (!real || (!quiet && real))
- if (!strcmp(retnotice.z_message, ZSRVACK_SENT)) {
- if (real) {
- if (verbose)
- printf("Successful\n");
- else
- printf("%s: Message sent\n",
- nrecips?notice->z_recipient:inst);
- }
+ if (!strcmp(retnotice.z_message, ZSRVACK_SENT)) {
+ success = 1;
+ if (real && !quiet) {
+ if (verbose)
+ printf("Successful\n");
else
- success = 1;
+ printf("%s: Message sent\n",
+ nrecips?notice->z_recipient:inst);
+ }
+ } 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",
+ class, inst);
+ else
+ printf("Not logged in or not subscribing to messages\n");
}
- else
- if (!strcmp(retnotice.z_message,
- ZSRVACK_NOTSENT)) {
- if (verbose && real) {
- if (strcmp(class, DEFAULT_CLASS))
- printf("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 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",
+ notice->z_recipient, class, inst);
else
- 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",
- notice->z_recipient, class, inst);
- else
- printf("%s: Not logged in or not subscribing to messages\n",
- notice->z_recipient);
- }
- }
- else
- printf("Internal failure - illegal message field in server response\n");
+ printf("%s: Not logged in or not subscribing to messages\n",
+ notice->z_recipient);
+ }
+ }
+ }
+ else
+ printf("Internal failure - illegal message field in server response\n");
ZFreeNotice(&retnotice);
if (!nrecips)
break;
}
- if (!real && !success)
+ if (!success)
exit(1);
}