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 stringi 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");
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':