a3: geändert

This commit is contained in:
Johannes Theiner 2018-11-02 14:04:23 +01:00
parent ed1dde77f3
commit 663521c5f5
1 changed files with 16 additions and 11 deletions

View File

@ -6,27 +6,30 @@
void memdump(unsigned char *string) {
int i;
unsigned char buffer[16];
unsigned char buffer[64];
printf("ADDR 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 0123456789ABCDEF\n");
for(i = 0; i <= 32; i++) {
printf("ADDR 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 0123456789ABCDEF\n");
for(i = 0; i <= 64; i++) {
string++;
if((i % 16) == 0) {
if(i != 0) printf(" %s\n", string++);
if(i != 0) printf(" %s\n", string);
printf("0x%04x ", *string);
buffer[i] = string[i];
}
printf(" %02x", string[i]);
if ((string[i] < 0x20) || (string[i] > 0x7e)) {
buffer[i % 16] = '.';
} else {
buffer[i % 16] = string[i];
}
/*if ((string[i] < 0x20) || (string[i] > 0x7e))
buffer[i] = '.';
else
buffer[i] = string[i];*/
buffer[(i % 16) + 1] = '\0';
}
while ((i % 16) != 0) {
printf(" ");
i++;
}
printf(" %s\n", buffer);
}
@ -41,7 +44,7 @@ int main(int argc, char **argv) {
}
memdump((unsigned char*)argv);
memdump((unsigned char*)*argv);
char **lastAddress;
int count = memreplace(argv[1], *argv[2], *argv[3], 0);
@ -52,4 +55,6 @@ int main(int argc, char **argv) {
memdump((unsigned char*)argv[1]);
free(argv);
return 0;
}