cURL / Mailing Lists / curl-users / Single Mail

curl-users

RE: 7.9.7 pre-release 2

From: Roth, Kevin P. <KPRoth_at_MarathonOil.com>
Date: Thu, 9 May 2002 15:19:21 -0400

Since I suggest the --trace-ascii format, I get to say what it looks like, right? ;-)

Here's a small patch for src/main.c that inserts newlines in place of 0D 0A sequences, making the trace file a little easier to read through.

$ diff -uN main.c main.c.new
--- main.c Tue May 7 09:13:18 2002
+++ main.c.new Thu May 9 15:16:26 2002
@@ -1951,7 +1951,7 @@
     /* without the hex output, we can fit more on screen */
     width = 0x40;
 
- fprintf(stream, "%s %d (0x%x) bytes\n", text, size, size);
+ fprintf(stream, "%s, %d bytes (0x%x)\n", text, size, size);
 
   for(i=0; i<size; i+= width) {
 
@@ -1965,12 +1965,22 @@
         else
           fputs(" ", stream);
     }
- for(c = 0; (c < width) && (i+c < size); c++)
+
+ for(c = 0; (c < width) && (i+c < size); c++) {
+ /* check for 0D0A; if found, skip past and start a new line of output */
+ if (nohex && (i+c+1 < size) && ptr[i+c]==0x0D && ptr[i+c+1]==0x0A) {
+ i+=(c+2-width);
+ break;
+ }
       fprintf(stream, "%c",
               (ptr[i+c]>=0x20) && (ptr[i+c]<0x80)?ptr[i+c]:'.');
-
+ /* check again for 0D0A, to avoid an extra \n if it's at width */
+ if (nohex && (i+c+2 < size) && ptr[i+c+1]==0x0D && ptr[i+c+2]==0x0A) {
+ i+=(c+3-width);
+ break;
+ }
+ }
     fputc('\n', stream); /* newline */
-
   }
 }
 

Thanks,
--Kevin

_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: bandwidth_at_sourceforge.net
Received on 2002-05-09