summaryrefslogtreecommitdiff
path: root/int2tap.c
diff options
context:
space:
mode:
Diffstat (limited to 'int2tap.c')
-rw-r--r--int2tap.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/int2tap.c b/int2tap.c
index ccfce7f..d38b63a 100644
--- a/int2tap.c
+++ b/int2tap.c
@@ -54,10 +54,28 @@ static void Usage(void)
{
fprintf(stderr,"%s: usage %s [-b] [-s] [-a addr] [-c addr] "
"output-file input-file ... \n",progname,progname);
+
exit(EXIT_FAILURE);
}
+static unsigned ToUnsigned(const char *p)
+{
+ char *end;
+ unsigned u;
+
+ u=(unsigned)strtoul(p,&end,0);
+
+ if (end==p || *end!=0)
+ {
+ fprintf(stderr,"%s: invalid number %s\n",progname,p);
+ exit(EXIT_FAILURE);
+ }
+
+ return u;
+}
+
+
/* ---------------------------------------- MAIN
*/
int main(int argc, char *argv[])
@@ -108,6 +126,10 @@ int main(int argc, char *argv[])
{
switch(argv[f][1])
{
+ case 'h':
+ Usage();
+ break;
+
case 'b':
bin_only=TRUE;
break;
@@ -123,7 +145,7 @@ int main(int argc, char *argv[])
}
addr_defined=TRUE;
- exec_addr=(unsigned)strtoul(argv[++f],NULL,0);
+ exec_addr=ToUnsigned(argv[++f]);
break;
@@ -134,7 +156,7 @@ int main(int argc, char *argv[])
}
clear_defined=TRUE;
- clear_addr=(unsigned)strtoul(argv[++f],NULL,0);
+ clear_addr=ToUnsigned(argv[++f]);
break;