summaryrefslogtreecommitdiff
path: root/ndisasm.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2002-04-30 21:01:38 +0000
committerH. Peter Anvin <hpa@zytor.com>2002-04-30 21:01:38 +0000
commit4cf1748e6829f80be251b8d7d274738009f934cf (patch)
tree59260e9aa7867952d80890859c0d06f6665fdfa5 /ndisasm.c
parent734b188090539eddf08e61c317415f566446691b (diff)
downloadnasm-4cf1748e6829f80be251b8d7d274738009f934cf.tar.gz
nasm-4cf1748e6829f80be251b8d7d274738009f934cf.tar.bz2
nasm-4cf1748e6829f80be251b8d7d274738009f934cf.zip
NASM 0.98.11
Diffstat (limited to 'ndisasm.c')
-rw-r--r--ndisasm.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/ndisasm.c b/ndisasm.c
index 354ea3c..227dde7 100644
--- a/ndisasm.c
+++ b/ndisasm.c
@@ -27,7 +27,7 @@ static const char *help =
" -u sets USE32 (32-bit mode)\n"
" -b 16 or -b 32 sets number of bits too\n"
" -h displays this text\n"
-" -r displays the version number\n"
+" -r or -v displays the version number\n"
" -e skips <bytes> bytes of header\n"
" -k avoids disassembling <bytes> bytes from position <start>\n"
" -p selects the preferred vendor instruction set (intel, amd, cyrix, idt)\n";
@@ -42,7 +42,8 @@ int main(int argc, char **argv)
char *pname = *argv;
char *filename = NULL;
unsigned long nextsync, synclen, initskip = 0L;
- int lenread, lendis;
+ int lenread;
+ long lendis;
int autosync = FALSE;
int bits = 16;
int eof = FALSE;
@@ -68,7 +69,8 @@ int main(int argc, char **argv)
fprintf(stderr, help);
return 0;
case 'r':
- fprintf(stderr, "NDISASM version " NASM_VER "\n");
+ case 'v':
+ fprintf(stderr, "NDISASM version %s compiled " __DATE__ "\n", NASM_VER);
return 0;
case 'u': /* USE32 */
bits = 32;
@@ -181,6 +183,10 @@ int main(int argc, char **argv)
}
p = ""; /* force to next argument */
break;
+ default: /*bf*/
+ fprintf(stderr, "%s: unrecognised option `-%c'\n",
+ pname, *p);
+ return 1;
}
} else if (!filename) {
filename = p;
@@ -227,7 +233,7 @@ int main(int argc, char **argv)
} else
lenread = 0;
p += lenread;
- if (offset == nextsync) {
+ if ((unsigned long)offset == nextsync) {
if (synclen) {
printf("%08lX skipping 0x%lX bytes\n", offset, synclen);
offset += synclen;
@@ -239,7 +245,7 @@ int main(int argc, char **argv)
while (p > q && (p - q >= INSN_MAX || lenread == 0)) {
lendis = disasm (q, outbuf, bits, offset, autosync, prefer);
if (!lendis || lendis > (p - q) ||
- lendis > nextsync-offset)
+ (unsigned long)lendis > nextsync-offset)
lendis = eatbyte (q, outbuf);
output_ins (offset, q, lendis, outbuf);
q += lendis;