- if (bulklen && fwrite(reply,bulklen,1,stdout) == 0) {
- zfree(reply);
- return 1;
+ if (!isatty(fileno(stdout))) {
+ if (bulklen && fwrite(reply,bulklen,1,stdout) == 0) {
+ zfree(reply);
+ return 1;
+ }
+ if (reply[bulklen-1] != '\n') printf("\n");
+ } else {
+ /* If you are producing output for the standard output we want
+ * a more interesting output with quoted characters and so forth */
+ printStringRepr(reply,bulklen);