4.104.114.84.95
Last change
on this file since 738a9ae was
3160ff6,
checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:54:19
|
2003-09-04 Joel Sherrill <joel@…>
- cpuuse/cpuuse.c, cpuuse/cpuuse.h, devnull/devnull.c,
devnull/devnull.h, dummy/dummy.c, dumpbuf/dumpbuf.c,
dumpbuf/dumpbuf.h, fsmount/fsmount.c, fsmount/fsmount.h,
serdbg/serdbgio.c, serdbg/termios_printk.c, stackchk/check.c,
stackchk/internal.h, stackchk/stackchk.h, untar/untar.c,
untar/untar.h: URL for license changed.
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | /* |
---|
2 | * COPYRIGHT (c) 1997. |
---|
3 | * On-Line Applications Research Corporation (OAR). |
---|
4 | * |
---|
5 | * The license and distribution terms for this file may in |
---|
6 | * the file LICENSE in this distribution or at |
---|
7 | * http://www.rtems.com/license/LICENSE. |
---|
8 | * |
---|
9 | * $Id$ |
---|
10 | */ |
---|
11 | |
---|
12 | #ifdef HAVE_CONFIG_H |
---|
13 | #include "config.h" |
---|
14 | #endif |
---|
15 | |
---|
16 | #include <stdio.h> |
---|
17 | #include <string.h> |
---|
18 | #include <ctype.h> |
---|
19 | #include <rtems/dumpbuf.h> |
---|
20 | |
---|
21 | /* |
---|
22 | * Put the body below Dump_Buffer so it won't get inlined. |
---|
23 | */ |
---|
24 | |
---|
25 | static inline void Dump_Line( |
---|
26 | unsigned char *buffer, |
---|
27 | int length |
---|
28 | ); |
---|
29 | |
---|
30 | void Dump_Buffer( |
---|
31 | unsigned char *buffer, |
---|
32 | int length |
---|
33 | ) |
---|
34 | { |
---|
35 | |
---|
36 | int i, mod, max; |
---|
37 | |
---|
38 | if ( !length ) return; |
---|
39 | |
---|
40 | mod = length % 16; |
---|
41 | |
---|
42 | max = length - mod; |
---|
43 | |
---|
44 | for ( i=0 ; i<max ; i+=16 ) |
---|
45 | Dump_Line( &buffer[ i ], 16 ); |
---|
46 | |
---|
47 | if ( mod ) |
---|
48 | Dump_Line( &buffer[ max ], mod ); |
---|
49 | } |
---|
50 | |
---|
51 | static inline void Dump_Line( |
---|
52 | unsigned char *buffer, |
---|
53 | int length |
---|
54 | ) |
---|
55 | { |
---|
56 | |
---|
57 | int i; |
---|
58 | char line_buffer[120]; |
---|
59 | |
---|
60 | line_buffer[0] = '\0'; |
---|
61 | |
---|
62 | for( i=0 ; i<length ; i++ ) |
---|
63 | sprintf( line_buffer, "%s%02x ", line_buffer, buffer[ i ] ); |
---|
64 | |
---|
65 | for( ; i<16 ; i++ ) |
---|
66 | strcat( line_buffer, " " ); |
---|
67 | |
---|
68 | strcat( line_buffer, "|" ); |
---|
69 | for( i=0 ; i<length ; i++ ) |
---|
70 | sprintf( line_buffer, "%s%c", line_buffer, |
---|
71 | isprint( buffer[ i ] ) ? buffer[ i ] : '.' ); |
---|
72 | |
---|
73 | for( ; i<16 ; i++ ) |
---|
74 | strcat( line_buffer, " " ); |
---|
75 | |
---|
76 | strcat( line_buffer, "|\n" ); |
---|
77 | |
---|
78 | printf( line_buffer ); |
---|
79 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.