2011-06-09 11:33:38 +02:00
|
|
|
diff --git a/utils/isohybrid.c b/utils/isohybrid.c
|
2011-07-26 11:48:21 +02:00
|
|
|
index 7ee9a7f..8a60531 100644
|
2011-06-09 11:33:38 +02:00
|
|
|
--- a/utils/isohybrid.c
|
|
|
|
+++ b/utils/isohybrid.c
|
2011-07-26 11:48:21 +02:00
|
|
|
@@ -108,6 +108,7 @@ printh(void)
|
|
|
|
int
|
|
|
|
check_option(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
+ char *err = NULL;
|
|
|
|
int n = 0, ind = 0;
|
|
|
|
|
|
|
|
const char optstr[] = ":h:s:e:o:t:i:fcp?vV";
|
|
|
|
@@ -135,32 +136,38 @@ check_option(int argc, char *argv[])
|
2011-06-09 11:33:38 +02:00
|
|
|
switch (n)
|
|
|
|
{
|
|
|
|
case 'h':
|
|
|
|
- if (!sscanf(optarg, "%hu", &head) || head < 1 || head > 256)
|
2011-07-26 11:48:21 +02:00
|
|
|
+ head = strtoul(optarg, &err, 0);
|
|
|
|
+ if (head < 1 || head > 256)
|
2011-06-09 11:33:38 +02:00
|
|
|
errx(1, "invalid head: `%s', 1 <= head <= 256", optarg);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 's':
|
|
|
|
- if (!sscanf(optarg, "%hhu", §or) || sector < 1 || sector > 63)
|
2011-07-26 11:48:21 +02:00
|
|
|
+ sector = strtoul(optarg, &err, 0);
|
|
|
|
+ if (sector < 1 || sector > 63)
|
2011-06-09 11:33:38 +02:00
|
|
|
errx(1, "invalid sector: `%s', 1 <= sector <= 63", optarg);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'e':
|
|
|
|
- if (!sscanf(optarg, "%hhu", &entry) || entry < 1 || entry > 4)
|
2011-07-26 11:48:21 +02:00
|
|
|
+ entry = strtoul(optarg, &err, 0);
|
|
|
|
+ if (entry < 1 || entry > 4)
|
2011-06-09 11:33:38 +02:00
|
|
|
errx(1, "invalid entry: `%s', 1 <= entry <= 4", optarg);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'o':
|
|
|
|
- if (!sscanf(optarg, "%hhu", &offset) || offset > 64)
|
2011-07-26 11:48:21 +02:00
|
|
|
+ offset = strtoul(optarg, &err, 0);
|
|
|
|
+ if (*err || offset > 64)
|
2011-06-09 11:33:38 +02:00
|
|
|
errx(1, "invalid offset: `%s', 0 <= offset <= 64", optarg);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 't':
|
|
|
|
- if (!sscanf(optarg, "%hu", &type) || type > 255)
|
2011-07-26 11:48:21 +02:00
|
|
|
+ type = strtoul(optarg, &err, 0);
|
|
|
|
+ if (*err || type > 255)
|
2011-06-09 11:33:38 +02:00
|
|
|
errx(1, "invalid type: `%s', 0 <= type <= 255", optarg);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'i':
|
|
|
|
- if (!sscanf(optarg, "%u", &id))
|
2011-07-26 11:48:21 +02:00
|
|
|
+ id = strtoul(optarg, &err, 0);
|
|
|
|
+ if (*err)
|
2011-06-09 11:33:38 +02:00
|
|
|
errx(1, "invalid id: `%s'", optarg);
|
|
|
|
break;
|
|
|
|
|