FreeCalypso > hg > fc-pcsc-tools
diff libcommon/cardconnect.c @ 33:8a4f3d00d997
more refactoring of (select reader by number) logic
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 12 Feb 2021 17:28:05 +0000 |
parents | b37fcb235848 |
children | 360d07419357 |
line wrap: on
line diff
--- a/libcommon/cardconnect.c Fri Feb 12 17:22:25 2021 +0000 +++ b/libcommon/cardconnect.c Fri Feb 12 17:28:05 2021 +0000 @@ -8,6 +8,7 @@ SCARDCONTEXT hContext; SCARDHANDLE hCard; char *reader_list, *selected_reader; +unsigned select_reader_num; setup_pcsc_context() { @@ -57,14 +58,13 @@ return(0); } -select_reader_num(select_num) - unsigned select_num; +select_reader_by_num() { char *cp; unsigned num; for (cp = reader_list, num = 0; *cp; num++) { - if (num == select_num) { + if (num == select_reader_num) { selected_reader = cp; return(0); } @@ -72,7 +72,7 @@ } fprintf(stderr, "error: requested reader #%u, but only %u readers found\n", - select_num, num); + select_reader_num, num); SCardReleaseContext(hContext); exit(1); }