diff options
author | Dan Winship <danw@mit.edu> | 1999-03-22 16:07:33 +0000 |
---|---|---|
committer | Dan Winship <danw@mit.edu> | 1999-03-22 16:07:33 +0000 |
commit | 16902283abb64bf285fd3a5fa84268308cac070e (patch) | |
tree | a956ac4ae64f728a32076d9a8e10c3b17794b2c7 | |
parent | b86afecfe7fdedcce826470ab349b54a36e24728 (diff) |
Make it clear at what point the message has been queued by zhm, so people
know if ^C'ing might not work. (Based on a patch by Greg.) Also, put more
useful information about class/instance in the message.
-rw-r--r-- | clients/zwrite/zwrite.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/clients/zwrite/zwrite.c b/clients/zwrite/zwrite.c index 407b020..0b153c7 100644 --- a/clients/zwrite/zwrite.c +++ b/clients/zwrite/zwrite.c @@ -341,7 +341,7 @@ send_off(notice, real) int real; { int i, success, retval; - char bfr[BUFSIZ], realm_recip[BUFSIZ], *cp; + char bfr[BUFSIZ], realm_recip[BUFSIZ], dest[3 * BUFSIZ], *cp; ZNotice_t retnotice; success = 0; @@ -353,31 +353,45 @@ send_off(notice, real) } else { notice->z_recipient = (nrecips) ? recips[i] : ""; } + if (nrecips) + strcpy(dest, recips[i]); + else if (!strcmp(class, DEFAULT_CLASS)) + sprintf(dest, "instance \"%s\"", inst); + else if (!strcmp(inst, DEFAULT_INSTANCE)) + sprintf(dest, "class \"%s\"", class); + else + sprintf(dest, "class \"%s\", instance \"%s\"", class, inst); if (verbose && real) printf("Sending %smessage, class %s, instance %s, to %s\n", auth?"authenticated ":"", class, inst, nrecips?notice->z_recipient:"everyone"); if ((retval = ZSendNotice(notice, auth)) != ZERR_NONE) { - (void) sprintf(bfr, "while sending notice to %s", - nrecips?notice->z_recipient:inst); + (void) sprintf(bfr, "while sending notice to %s", dest); com_err(whoami, retval, bfr); break; } + if (real && !quiet) { + if (verbose) + printf("Queued... "); + else + printf("Message queued for %s... ", dest); + fflush(stdout); + } if ((retval = ZIfNotice(&retnotice, (struct sockaddr_in *) 0, ZCompareUIDPred, (char *)¬ice->z_uid)) != ZERR_NONE) { ZFreeNotice(&retnotice); (void) sprintf(bfr, "while waiting for acknowledgement for %s", - nrecips?notice->z_recipient:inst); + dest); com_err(whoami, retval, bfr); continue; } if (retnotice.z_kind == SERVNAK) { if (!quiet) { printf("Received authorization failure while sending to %s\n", - nrecips?notice->z_recipient:inst); + dest); } ZFreeNotice(&retnotice); break; /* if auth fails, punt */ @@ -385,20 +399,15 @@ send_off(notice, real) if (retnotice.z_kind != SERVACK || !retnotice.z_message_len) { if (!quiet) { printf("Detected server failure while receiving acknowledgement for %s\n", - nrecips?notice->z_recipient:inst); + dest); } ZFreeNotice(&retnotice); continue; } if (!strcmp(retnotice.z_message, ZSRVACK_SENT)) { success = 1; - if (real && !quiet) { - if (verbose) - printf("Successful\n"); - else - printf("%s: Message sent\n", - nrecips?notice->z_recipient:inst); - } + if (real && !quiet) + printf("sent\n"); } else if (!strcmp(retnotice.z_message, ZSRVACK_NOTSENT)) { if (verbose && real && !quiet) { if (strcmp(class, DEFAULT_CLASS)) { |