summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2005-07-13 11:25:16 +0000
committerSascha Hauer <s.hauer@pengutronix.de>2005-07-13 11:25:16 +0000
commit2db64a22201070842316e61057ebf6a279a0d22d (patch)
tree4daed564a96fb92385682546504d6a23b891d57d
parentb74ff3531a2774adb2b2397dcf2294cec3cc0897 (diff)
downloadmemedit-2db64a22201070842316e61057ebf6a279a0d22d.tar.gz
memedit-2db64a22201070842316e61057ebf6a279a0d22d.tar.xz
fixed ascii output for md.b, fixed compiler warnings
-rw-r--r--memedit.y15
1 files changed, 9 insertions, 6 deletions
diff --git a/memedit.y b/memedit.y
index 4e450ed..e9a963a 100644
--- a/memedit.y
+++ b/memedit.y
@@ -120,14 +120,16 @@ line: CR
;
open: OPEN { printf ("open <filename>\n"); }
- | OPEN filename {
+ | OPEN filename {
+ char *filename = (char *)$2;
+
if (fd>=0)
close (fd);
- fd = open($2, O_RDWR | O_SYNC);
+ fd = open(filename, O_RDWR | O_SYNC);
if (fd<0)
- printf ("open >%s< failed\n%s\n", $2, strerror(errno));
+ printf ("open >%s< failed\n%s\n", filename, strerror(errno));
- free ($2);
+ free (filename);
}
;
@@ -324,7 +326,7 @@ int get_variable (char *param) {
int hex_output (int offset, int len, int count) {
unsigned int c;
- int i=0, j, t, bytes;
+ int j, t, bytes;
unsigned char linebuf[LINELEN];
if (fd<0) {
@@ -333,6 +335,7 @@ int hex_output (int offset, int len, int count) {
}
while(1) {
+ unsigned char *linechar = (unsigned char *)linebuf;
unsigned int *lineint = (unsigned int *)linebuf;
unsigned short *lineshort = (unsigned short *)linebuf;
@@ -350,7 +353,7 @@ int hex_output (int offset, int len, int count) {
case 1:
c = *rbuff8++;
printf ("%02x ", c);
- linebuf[i] = c;
+ *linechar++ = c;
break;
case 2:
c = *rbuff16++;