lots of crap

This commit is contained in:
comex 2011-02-13 18:07:40 -05:00
parent 3ef72e9188
commit 1f0a8172db

View File

@ -34,10 +34,27 @@ int main(int argc, char **argv) {
void *stuff = malloc(size); void *stuff = malloc(size);
assert(read(patchfd, stuff, size) == (ssize_t) size); assert(read(patchfd, stuff, size) == (ssize_t) size);
if(addr != 0 && name[0] != '+') { if(addr == 0) goto skip;
printf("%s\n", name); if(name[0] == '+') goto skip;
memcpy((char *) kernel.start + range_to_off_range((range_t) {&binary, addr, size}).start, stuff, size);
if(argv[4] && !strcmp(argv[4], "-i")) {
retry:
printf("%s [y/n] ", name);
fflush(stdout);
char buf[3];
if(!fgets(buf, sizeof(buf), stdin)) abort();
if(!strcmp(buf, "n\n")) {
goto skip;
} else if(strcmp(buf, "y\n")) {
goto retry;
} }
} else {
printf("%s\n", name);
}
memcpy((char *) kernel.start + range_to_off_range((range_t) {&binary, addr, size}).start, stuff, size);
skip:
free(name); free(name);
free(stuff); free(stuff);