[2431] in Kerberos-V5-bugs
telnet/171: "toggle netdata" should display ASCII data
daemon@ATHENA.MIT.EDU (John Hawkinson)
Sun Nov 10 19:57:30 1996
Resent-From: gnats@rt-11.MIT.EDU (GNATS Management)
Resent-To: hartmans@MIT.EDU
Resent-Reply-To: krb5-bugs@MIT.EDU, jhawk@MIT.EDU
Date: Sun, 10 Nov 1996 19:56:47 -0500
From: John Hawkinson <jhawk@MIT.EDU>
Reply-To: jhawk@MIT.EDU
To: krb5-bugs@MIT.EDU
>Number: 171
>Category: telnet
>Synopsis: "toggle netdata" should display ASCII data
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: hartmans
>State: open
>Class: change-request
>Submitter-Id: unknown
>Arrival-Date: Sun Nov 10 19:57:00 EST 1996
>Last-Modified:
>Originator: John Hawkinson
>Organization:
MIT
>Release: 1.0-development
>Environment:
System: NetBSD lola-granola 1.1B NetBSD 1.1B (LOLA) #2: Thu Jul 11 00:13:13 EDT 1996 mycroft@zygorthian-space-raiders:/afs/sipb.mit.edu/project/netbsd/dev/current-source/build/i386_nbsd1/sys/arch/i386/compile/LOLA i386
>Description:
It is annoying that "toggle netdata" always produces hex
output, regardless of the setting of "toggle prettydump".
Particularly when debugging protocol problems that pertain
to ASCII data, converting from hex to ASCII by hand is
suboptimal, and using perl scripts to munge the data leave
a bad taste in one's mouth.
>How-To-Repeat:
>Fix:
Add "toggle sexydump" with a politically correct alias
(listed in helptext) of "toggle asciidump".
Here's a patch to appl/telnet/telnet.
This also hyphenates user-readable and clarifies what "toggle debug"
does (helptext fixes).
===================================================================
RCS file: RCS/utilities.c,v
retrieving revision 1.1
diff -c -r1.1 utilities.c
*** utilities.c 1996/11/10 23:09:15 1.1
--- utilities.c 1996/11/11 00:46:19
***************
*** 54,59 ****
--- 54,60 ----
FILE *NetTrace = 0; /* Not in bss, since needs to stay */
int prettydump;
+ int sexydump;
/*
* upcase()
***************
*** 147,152 ****
--- 148,177 ----
(*pThis)&0xff);
pThis++;
}
+ length -= BYTES_PER_LINE/2;
+ offset += BYTES_PER_LINE/2;
+ } else if (sexydump) {
+ unsigned char *q;
+ int i;
+
+ q = pThis;
+ buffer = buffer + min(length, BYTES_PER_LINE/2);
+
+ i = 0;
+ while (pThis < buffer) {
+ fprintf(NetTrace, "%.2x%s", *pThis++, i++%2?" ":"");
+ }
+ if (i % 2) { /* Need to ensure we've outputted an even number of bytes */
+ fprintf(NetTrace, " ");
+ i++;
+ }
+ fprintf(NetTrace, "%*s", 10 + (BYTES_PER_LINE/2 - i) / 2 * 5, "");
+
+ while (q < buffer) {
+ fputc(isprint(*q)?*q:'.', NetTrace);
+ q++;
+ }
+
length -= BYTES_PER_LINE/2;
offset += BYTES_PER_LINE/2;
} else {
===================================================================
RCS file: RCS/commands.c,v
retrieving revision 1.4
diff -c -r1.4 commands.c
*** commands.c 1996/10/30 04:12:43 1.4
--- commands.c 1996/11/11 00:01:24
***************
*** 740,746 ****
"print hexadecimal representation of curses data" },
#endif /* defined(unix) && defined(TN3270) */
{ "debug",
! "debugging",
togdebug,
&debug,
"turn on socket level debugging" },
--- 740,746 ----
"print hexadecimal representation of curses data" },
#endif /* defined(unix) && defined(TN3270) */
{ "debug",
! "debugging (socket level)",
togdebug,
&debug,
"turn on socket level debugging" },
***************
*** 750,759 ****
&netdata,
"print hexadecimal representation of network traffic" },
{ "prettydump",
! "output of \"netdata\" to user readable format (debugging)",
0,
&prettydump,
! "print user readable output for \"netdata\"" },
{ "options",
"viewing of options processing (debugging)",
0,
--- 750,769 ----
&netdata,
"print hexadecimal representation of network traffic" },
{ "prettydump",
! "output of \"netdata\" to user-readable format (debugging)",
0,
&prettydump,
! "print user-readable output for \"netdata\"" },
! { "asciidump",
! "output of \"netdata\" to a more user-readable format (debugging)",
! 0,
! &sexydump,
! "print ASCII user-readable output for \"netdata\"" },
! { "sexydump",
! NULL, /* Hidden version of asciidump */
! 0,
! &sexydump,
! "print ASCII user-readable output for \"netdata\"" },
{ "options",
"viewing of options processing (debugging)",
0,
===================================================================
RCS file: RCS/externs.h,v
retrieving revision 1.1
diff -c -r1.1 externs.h
*** externs.h 1996/11/10 23:09:20 1.1
--- externs.h 1996/11/10 23:58:51
***************
*** 150,155 ****
--- 150,156 ----
crmod,
netdata, /* Print out network data flow */
prettydump, /* Print "netdata" output in user-readable format */
+ sexydump, /* Print "netdata" output in an ASCII user-readable format */
#if defined(TN3270)
cursesdata, /* Print out curses data flow */
apitrace, /* Trace API transactions */
>Audit-Trail:
>Unformatted: