Soft'N'Design Software
/
projects
/
hexdump.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
70fd9a8
)
fix string copy overlay
author
Laurent Mazet
<mazet@softndesign.org>
Fri, 29 Dec 2023 20:55:37 +0000
(21:55 +0100)
committer
Laurent Mazet
<mazet@softndesign.org>
Fri, 29 Dec 2023 20:55:37 +0000
(21:55 +0100)
hexdump.c
patch
|
blob
|
blame
|
history
diff --git
a/hexdump.c
b/hexdump.c
index 8a085616731ce23ec2e92cb4aa4636c43c62feb5..77a413547e7936d7803a9d536527bb07ea3d9016 100644
(file)
--- a/
hexdump.c
+++ b/
hexdump.c
@@
-59,7
+59,7
@@
int usage (int ret)
fprintf (fd, "commands: [/hstr/|addr|+nb] [a hstr] [d nb|-] [i hstr] [p nb|-] [s/h1/h2/[g]]\n");
fprintf (fd, " addr: move to address (0... octal, [1-9]... deci, 0x... hexa)\n");
fprintf (fd, " +nb: move to offset (0... octal, [1-9]... deci, 0x... hexa)\n");
fprintf (fd, "commands: [/hstr/|addr|+nb] [a hstr] [d nb|-] [i hstr] [p nb|-] [s/h1/h2/[g]]\n");
fprintf (fd, " addr: move to address (0... octal, [1-9]... deci, 0x... hexa)\n");
fprintf (fd, " +nb: move to offset (0... octal, [1-9]... deci, 0x... hexa)\n");
- fprintf (fd, " //: move to hexa string
i
hstr\n");
+ fprintf (fd, " //: move to hexa string hstr\n");
fprintf (fd, " a : append hexa string hstr to current address\n");
fprintf (fd, " d : delete nb bytes (- until end file)\n");
fprintf (fd, " i : insert hexa string hstr to current address\n");
fprintf (fd, " a : append hexa string hstr to current address\n");
fprintf (fd, " d : delete nb bytes (- until end file)\n");
fprintf (fd, " i : insert hexa string hstr to current address\n");
@@
-482,8
+482,15
@@
int main (int argc, char *argv[])
case 'e':
arg = (arg[2]) ? arg + 2 : (--argc > 0) ? *(++argv) : NULL;
if (arg) {
case 'e':
arg = (arg[2]) ? arg + 2 : (--argc > 0) ? *(++argv) : NULL;
if (arg) {
- commands = (commands == NULL) ? arg :
- strcat (strcat (commands, " "), arg);
+ //commands = (commands == NULL) ? arg :
+ // strcat (strcat (commands, " "), arg);
+ if (commands == NULL) {
+ commands = arg;
+ } else {
+ char *tmp = (char *) malloc (strlen (arg) + 1);
+ strcat (strcat (commands, " "), strcpy (tmp, arg));
+ free (tmp);
+ }
}
break;
case 'i':
}
break;
case 'i':