projects
/
emu8051.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Change test output expected string layout
[emu8051.git]
/
src
/
hexfile.c
diff --git
a/src/hexfile.c
b/src/hexfile.c
index
ef828b8
..
6411166
100644
(file)
--- a/
src/hexfile.c
+++ b/
src/hexfile.c
@@
-40,10
+40,14
@@
void
int2asciihex(int val, char *str, int width)
{
void
int2asciihex(int val, char *str, int width)
{
- if (width == 2)
+ if (width == 1)
+ sprintf(str , "%.1X", (u_int8_t) val);
+ else if (width == 2)
sprintf(str , "%.2X", (u_int8_t) val);
else if (width == 4)
sprintf(str , "%.4X", (u_int16_t) val);
sprintf(str , "%.2X", (u_int8_t) val);
else if (width == 4)
sprintf(str , "%.4X", (u_int16_t) val);
+ else
+ sprintf(str , "Err");
}
/* Convert ASCII hex string to integer. */
}
/* Convert ASCII hex string to integer. */
@@
-106,7
+110,7
@@
LoadHexFile(const char *filename)
/* Trying to open the file. */
fp = fopen(filename, "r");
if (fp == NULL) {
/* Trying to open the file. */
fp = fopen(filename, "r");
if (fp == NULL) {
- perror(
PACKAGE
);
+ perror(
filename
);
/*ErrorLocation(__FILE__, __LINE__);*/
exit(EXIT_FAILURE);
}
/*ErrorLocation(__FILE__, __LINE__);*/
exit(EXIT_FAILURE);
}