projects
/
libam7xxx.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
a878cff
)
Wrap lines when dumping big buffers
author
Antonio Ospite <ospite@studenti.unina.it>
Sat, 7 Jan 2012 00:44:01 +0000
(
01:44
+0100)
committer
Antonio Ospite <ospite@studenti.unina.it>
Sat, 7 Jan 2012 00:59:32 +0000
(
01:59
+0100)
picoproj.c
patch
|
blob
|
history
diff --git
a/picoproj.c
b/picoproj.c
index
197d5da
..
7e7cdd5
100644
(file)
--- a/
picoproj.c
+++ b/
picoproj.c
@@
-130,6
+130,11
@@
static void dump_header(struct header *h)
fflush(stdout);
}
+static inline unsigned int in_80chars(unsigned int i)
+{
+ return ((i+1) % (80/3));
+}
+
static void dump_buffer(uint8_t *buffer, unsigned int len)
{
unsigned int i;
@@
-138,7
+143,7
@@
static void dump_buffer(uint8_t *buffer, unsigned int len)
return;
for (i = 0; i < len; i++) {
- printf("%02hhX%c", buffer[i], (i
< len - 1
) ? ' ' : '\n');
+ printf("%02hhX%c", buffer[i], (i
n_80chars(i) && (i < len - 1)
) ? ' ' : '\n');
}
fflush(stdout);
}