Lines 63-68
Link Here
|
63 |
|
63 |
|
64 |
#include <ctype.h> |
64 |
#include <ctype.h> |
65 |
#include <err.h> |
65 |
#include <err.h> |
|
|
66 |
#include <errno.h> |
66 |
#include <fcntl.h> |
67 |
#include <fcntl.h> |
67 |
#include <libufs.h> |
68 |
#include <libufs.h> |
68 |
#include <paths.h> |
69 |
#include <paths.h> |
Lines 148-166
Link Here
|
148 |
while ((ch=getopt(argc, argv, "g:i:l:o:")) != -1) { |
149 |
while ((ch=getopt(argc, argv, "g:i:l:o:")) != -1) { |
149 |
switch(ch) { |
150 |
switch(ch) { |
150 |
case 'g': |
151 |
case 'g': |
151 |
cfg_cg=atol(optarg); |
152 |
cfg_cg=strtol(optarg, NULL, 0); |
|
|
153 |
if(errno == EINVAL||errno == ERANGE) |
154 |
err(1, "%s", optarg); |
152 |
if(cfg_cg < -1) { |
155 |
if(cfg_cg < -1) { |
153 |
usage(); |
156 |
usage(); |
154 |
} |
157 |
} |
155 |
break; |
158 |
break; |
156 |
case 'i': |
159 |
case 'i': |
157 |
cfg_in=atol(optarg); |
160 |
cfg_in=strtol(optarg, NULL, 0); |
|
|
161 |
if(errno == EINVAL||errno == ERANGE) |
162 |
err(1, "%s", optarg); |
158 |
if(cfg_in < 0) { |
163 |
if(cfg_in < 0) { |
159 |
usage(); |
164 |
usage(); |
160 |
} |
165 |
} |
161 |
break; |
166 |
break; |
162 |
case 'l': |
167 |
case 'l': |
163 |
cfg_lv=atol(optarg); |
168 |
cfg_lv=strtol(optarg, NULL, 0); |
|
|
169 |
if(errno == EINVAL||errno == ERANGE) |
170 |
err(1, "%s", optarg); |
164 |
if(cfg_lv < 0x1||cfg_lv > 0x3ff) { |
171 |
if(cfg_lv < 0x1||cfg_lv > 0x3ff) { |
165 |
usage(); |
172 |
usage(); |
166 |
} |
173 |
} |