From: notaz Date: Fri, 14 Feb 2014 01:48:09 +0000 (+0200) Subject: cmpmrg_text: allow to skip actual comparison X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0d9cac631f101c5e13152ae21d5b9b5d5200fba;p=ia32rtools.git cmpmrg_text: allow to skip actual comparison not always needed --- diff --git a/tools/cmpmrg_text.c b/tools/cmpmrg_text.c index 3862ef3..015db89 100644 --- a/tools/cmpmrg_text.c +++ b/tools/cmpmrg_text.c @@ -482,24 +482,33 @@ int main(int argc, char *argv[]) FILE *f_obj, *f_exe; SCNHDR tmphdr; long sztext_cmn; + int do_cmp = 1; int retval = 1; int left; + int arg; int ret; int i; - if (argc != 3) { - printf("usage:\n%s \n", argv[0]); + for (arg = 1; arg < argc; arg++) { + if (!strcmp(argv[arg], "-n")) + do_cmp = 0; + else + break; + } + + if (argc != arg + 2) { + printf("usage:\n%s [-n] \n", argv[0]); return 1; } - f_obj = fopen(argv[1], "r+b"); + f_obj = fopen(argv[arg++], "r+b"); if (f_obj == NULL) { fprintf(stderr, "%s: ", argv[1]); perror(""); return 1; } - f_exe = fopen(argv[2], "r"); + f_exe = fopen(argv[arg++], "r"); if (f_exe == NULL) { fprintf(stderr, "%s: ", argv[2]); perror(""); @@ -539,6 +548,7 @@ int main(int argc, char *argv[]) } } + if (do_cmp) for (i = 0; i < sztext_cmn; i++) { if (s_text_obj.data[i] == s_text_exe.data[i])