From 16902283abb64bf285fd3a5fa84268308cac070e Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 22 Mar 1999 16:07:33 +0000 Subject: 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. --- clients/zwrite/zwrite.c | 35 ++++++++++++++++++++++------------- 1 file 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)) { -- cgit v1.2.3