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:
frankmorgner
2010-10-04 13:54:58 +00:00
parent 35ce942354
commit 837d952bb9
2 changed files with 10 additions and 4 deletions

View File

@@ -274,7 +274,7 @@ struct hid_class_descriptor {
/**
* @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] verbose Verbosity level passed to \c sc_context_t
*

View File

@@ -1736,7 +1736,9 @@ main (int argc, char **argv)
exit(0);
break;
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);
exit(2);
}
@@ -1748,13 +1750,17 @@ main (int argc, char **argv)
doiintf = optarg;
break;
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);
exit(2);
}
break;
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);
exit(2);
}