mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
Kein Roth made --trace-ascii look even better, and make OD 0A occurances
get output as plain newlines.
This commit is contained in:
parent
2ff2810a92
commit
06bdf83419
18
src/main.c
18
src/main.c
@ -1951,7 +1951,7 @@ void dump(const char *text,
|
|||||||
/* without the hex output, we can fit more on screen */
|
/* without the hex output, we can fit more on screen */
|
||||||
width = 0x40;
|
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) {
|
for(i=0; i<size; i+= width) {
|
||||||
|
|
||||||
@ -1965,12 +1965,22 @@ void dump(const char *text,
|
|||||||
else
|
else
|
||||||
fputs(" ", stream);
|
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",
|
fprintf(stream, "%c",
|
||||||
(ptr[i+c]>=0x20) && (ptr[i+c]<0x80)?ptr[i+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 */
|
fputc('\n', stream); /* newline */
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user