home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / bugs / 2bsd / 77 < prev    next >
Encoding:
Text File  |  1992-08-25  |  2.8 KB  |  93 lines

  1. Newsgroups: comp.bugs.2bsd
  2. Path: sparky!uunet!europa.asd.contel.com!awds.imsd.contel.com!wlbr!sms
  3. From: sms@WLV.IIPO.GTEGSC.COM (Steven M. Schultz)
  4. Subject: telnet netdata dump misformatted, workaround for _doprnt (#70)
  5. Message-ID: <1992Aug26.042427.29809@wlbr.iipo.gtegsc.com>
  6. Sender: news@wlbr.iipo.gtegsc.com (news)
  7. Nntp-Posting-Host: wlv.iipo.gtegsc.com
  8. Organization: GTE Government Systems
  9. Date: Wed, 26 Aug 92 04:24:27 GMT
  10. Lines: 81
  11.  
  12. Subject: telnet netdata dump misformatted, workaround for _doprnt (#70)
  13. Index:    ucb/telnet.c 2.11BSD
  14.  
  15. Description:
  16.     Using "toggle netdata" results in a misformatted hex display.
  17.  
  18. Repeat-By:
  19.     Issue a "toggle netdata" command and observe the hex dump produced
  20.     by telnet.  There are extra 0 characters present because of the
  21.     way _doprnt processes format specs such as "%.2x".
  22.  
  23.     The 4.3BSD _doprnt generates the expected two digit display for
  24.     each byte.  The 2.11BSD _doprnt does not, instead a leading 0
  25.     is produced!
  26.  
  27.     The following test program will show how the 2.11BSD _doprnt
  28.     handles the various attempts at producing a 2 hex digit output
  29.     for a byte of data:
  30.  
  31.     -------------------------cut here----------------------------
  32.     char    *p;
  33.  
  34. main()
  35.     {
  36.     printf("2.2|%2.2x\n", 0xff);
  37.     printf(".2|%.2x\n", 0xff);
  38.     printf("2|%2x\n", 0xff);
  39.     printf("02|%02x\n", 0xff);
  40.     putchar('\n');
  41.     printf("2.2|%2.2x\n", 0x05);
  42.     printf(".2|%.2x\n", 0x05);
  43.     printf("2|%2x\n", 0x05);
  44.     printf("02|%02x\n", 0x05);
  45.     }
  46.     -------------------------cut here------------------------
  47.     Results:
  48.  2.2|0ff
  49.  .2|0ff
  50.  2|ff
  51.  02|ff
  52.  
  53.  2.2|05
  54.  .2|05
  55.  2| 5
  56.  02|05
  57.  
  58. Fix:
  59.     Rewriting _doprnt is not something i really want to do at the
  60.     moment (volunteers?).  The 4.3BSD assembly language version makes 
  61.     use of Vax instructions such as "editpc", etc - not pleasant things to
  62.     emulate.  The 4.3Reno version is written in C but appears to
  63.     be insistent/dependent on having an "unsigned long" data type which
  64.     is not currently available in the 2.11BSD C compiler.
  65.  
  66.     Rather than rewriting/fixing doprnt.s the format spec was changed
  67.     in telnet.c to produce the desired output.
  68.  
  69.     Apply the (very small) change to telnet.c and reinstall 'telnet'.
  70.     You'll first want to install patch #69 which fixes the %c bug
  71.     in _doprnt.
  72.  
  73. -----------------------cut here-------------------------------
  74. *** /usr/src/ucb/telnet.c.old    Tue Jul 31 13:39:39 1990
  75. --- /usr/src/ucb/telnet.c    Tue Aug 25 13:33:00 1992
  76. ***************
  77. *** 551,557 ****
  78.       pThis = buffer;
  79.       buffer = buffer+min(length, BYTES_PER_LINE);
  80.       while (pThis < buffer) {
  81. !         fprintf(NetTrace, "%.2x", (*pThis)&0xff);
  82.           pThis++;
  83.       }
  84.       fprintf(NetTrace, "\n");
  85. --- 551,557 ----
  86.       pThis = buffer;
  87.       buffer = buffer+min(length, BYTES_PER_LINE);
  88.       while (pThis < buffer) {
  89. !         fprintf(NetTrace, "%02x", (*pThis)&0xff);
  90.           pThis++;
  91.       }
  92.       fprintf(NetTrace, "\n");
  93.