# HG changeset patch # User Mychaela Falconia # Date 1615684957 0 # Node ID 11f4f8a8fa33513f8532e95be1595d52f6974c50 # Parent f7a03e53bb2cf3a847f6586c620967731cafd99a pcsc: ATR code refactoring diff -r f7a03e53bb2c -r 11f4f8a8fa33 pcsc/atrfunc.c --- a/pcsc/atrfunc.c Sun Mar 14 01:09:23 2021 +0000 +++ b/pcsc/atrfunc.c Sun Mar 14 01:22:37 2021 +0000 @@ -10,7 +10,8 @@ #define MAX_ATR_BYTES 33 -retrieve_atr(decor) +retrieve_atr(head) + char *head; { u_char atrbuf[MAX_ATR_BYTES]; LONG rv; @@ -25,12 +26,9 @@ SCardReleaseContext(hContext); exit(1); } - if (decor) - printf("ATR:"); + fputs(head, stdout); for (n = 0; n < dwAttrLen; n++) { - if (decor) - putchar(' '); - printf("%02X", atrbuf[n]); + printf(" %02X", atrbuf[n]); } putchar('\n'); return(0); diff -r f7a03e53bb2c -r 11f4f8a8fa33 pcsc/atrmain.c --- a/pcsc/atrmain.c Sun Mar 14 01:09:23 2021 +0000 +++ b/pcsc/atrmain.c Sun Mar 14 01:22:37 2021 +0000 @@ -16,7 +16,7 @@ select_reader_by_num(); printf("Card reader name: %s\n", selected_reader); connect_to_card(); - retrieve_atr(1); + retrieve_atr("ATR:"); SCardDisconnect(hCard, SCARD_UNPOWER_CARD); SCardReleaseContext(hContext); exit(0);