using strtol instead of sscanf
git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@296 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
@@ -274,7 +274,7 @@ struct hid_class_descriptor {
|
|||||||
/**
|
/**
|
||||||
* @brief Initializes reader for relaying
|
* @brief Initializes reader for relaying
|
||||||
*
|
*
|
||||||
* @param[in] reader_id (optional) Index to the reader to be used. Set to -1 to use a reader with a inserted card.
|
* @param[in] reader_id (optional) Index to the reader to be used. Set to -1 to use the first reader with a card or the first reader if no card is available.
|
||||||
* @param[in] cdriver (optional) Card driver to be used
|
* @param[in] cdriver (optional) Card driver to be used
|
||||||
* @param[in] verbose Verbosity level passed to \c sc_context_t
|
* @param[in] verbose Verbosity level passed to \c sc_context_t
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1736,7 +1736,9 @@ main (int argc, char **argv)
|
|||||||
exit(0);
|
exit(0);
|
||||||
break;
|
break;
|
||||||
case OPT_READER:
|
case OPT_READER:
|
||||||
if (sscanf(optarg, "%d", &usb_reader_num) != 1) {
|
errno = 0;
|
||||||
|
usb_reader_num = strtol(optarg, NULL, 10);
|
||||||
|
if (errno) {
|
||||||
parse_error(argv[0], options, option_help, optarg, oindex);
|
parse_error(argv[0], options, option_help, optarg, oindex);
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
@@ -1748,13 +1750,17 @@ main (int argc, char **argv)
|
|||||||
doiintf = optarg;
|
doiintf = optarg;
|
||||||
break;
|
break;
|
||||||
case OPT_PRODUCT:
|
case OPT_PRODUCT:
|
||||||
if (sscanf(optarg, "%x", &productid) != 1) {
|
errno = 0;
|
||||||
|
productid = strtol(optarg, NULL, 16);
|
||||||
|
if (errno) {
|
||||||
parse_error(argv[0], options, option_help, optarg, oindex);
|
parse_error(argv[0], options, option_help, optarg, oindex);
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OPT_VENDOR:
|
case OPT_VENDOR:
|
||||||
if (sscanf(optarg, "%x", &vendorid) != 1) {
|
errno = 0;
|
||||||
|
vendorid = strtol(optarg, NULL, 16);
|
||||||
|
if (errno) {
|
||||||
parse_error(argv[0], options, option_help, optarg, oindex);
|
parse_error(argv[0], options, option_help, optarg, oindex);
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user