diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2005-07-13 11:25:16 +0000 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2005-07-13 11:25:16 +0000 |
commit | 2db64a22201070842316e61057ebf6a279a0d22d (patch) | |
tree | 4daed564a96fb92385682546504d6a23b891d57d | |
parent | b74ff3531a2774adb2b2397dcf2294cec3cc0897 (diff) | |
download | memedit-2db64a22201070842316e61057ebf6a279a0d22d.tar.gz memedit-2db64a22201070842316e61057ebf6a279a0d22d.tar.xz |
fixed ascii output for md.b, fixed compiler warnings
-rw-r--r-- | memedit.y | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -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++; |