=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/telnet/utilities.c,v retrieving revision 1.21 retrieving revision 1.22 diff -c -r1.21 -r1.22 *** src/usr.bin/telnet/utilities.c 2014/09/09 03:41:08 1.21 --- src/usr.bin/telnet/utilities.c 2017/08/22 15:04:18 1.22 *************** *** 1,4 **** ! /* $OpenBSD: utilities.c,v 1.21 2014/09/09 03:41:08 guenther Exp $ */ /* $NetBSD: utilities.c,v 1.5 1996/02/28 21:04:21 thorpej Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: utilities.c,v 1.22 2017/08/22 15:04:18 bluhm Exp $ */ /* $NetBSD: utilities.c,v 1.5 1996/02/28 21:04:21 thorpej Exp $ */ /* *************** *** 575,620 **** fprintf(NetTrace, "INFO "); env_common: { ! int noquote = 2; for (i = 2; i < length; i++ ) { switch (pointer[i]) { case NEW_ENV_VALUE: ! fprintf(NetTrace, "\" VALUE " + noquote); ! noquote = 2; break; case NEW_ENV_VAR: ! fprintf(NetTrace, "\" VAR " + noquote); ! noquote = 2; break; case ENV_ESC: ! fprintf(NetTrace, "\" ESC " + noquote); ! noquote = 2; break; case ENV_USERVAR: ! fprintf(NetTrace, "\" USERVAR " + noquote); ! noquote = 2; break; default: if (isprint((unsigned char)pointer[i]) && pointer[i] != '"') { ! if (noquote) { ! putc('"', NetTrace); ! noquote = 0; ! } ! putc(pointer[i], NetTrace); } else { ! fprintf(NetTrace, "\" %03o " + noquote, ! pointer[i]); ! noquote = 2; } break; } } ! if (!noquote) putc('"', NetTrace); break; } --- 575,618 ---- fprintf(NetTrace, "INFO "); env_common: { ! int quote = 0; for (i = 2; i < length; i++ ) { switch (pointer[i]) { case NEW_ENV_VALUE: ! fprintf(NetTrace, "%sVALUE ", quote ? "\" " : ""); ! quote = 0; break; case NEW_ENV_VAR: ! fprintf(NetTrace, "%sVAR ", quote ? "\" " : ""); ! quote = 0; break; case ENV_ESC: ! fprintf(NetTrace, "%sESC ", quote ? "\" " : ""); ! quote = 0; break; case ENV_USERVAR: ! fprintf(NetTrace, "%sUSERVAR ", quote ? "\" " : ""); ! quote = 0; break; default: if (isprint((unsigned char)pointer[i]) && pointer[i] != '"') { ! fprintf(NetTrace, "%s%c", ! quote ? "" : "\"", pointer[i]); ! quote = 1; } else { ! fprintf(NetTrace, "%s%03o ", ! quote ? "\" " : "", pointer[i]); ! quote = 0; } break; } } ! if (quote) putc('"', NetTrace); break; }